Sun Nov 29 2020 18:22:05 GMT+0000 (Coordinated Universal Time)
Saved by @ankity09 #aws,ckad
docker build -t java-hello-world:1.0.0 .
Builds the Dockerfile from the specified directory
#aws,ckad
kubectl run frontend --image=nginx --port=80 \ -o yaml --dry-run=client > pod.yaml
kubectl edit pod frontend
FROM openjdk:11-jre-slim WORKDIR /app COPY target/java-hello-world-0.0.1.jar java-hello-world.jar ENTRYPOINT ["java", "-jar", "/app/java-hello-world.jar"] EXPOSE 8080
docker run -d -p 8080:8080 java-hello-world:1.0.0
kubectl run hazelcast --image=hazelcast/hazelcast --port=5701 \ --env="DNS_DOMAIN=cluster" --labels="app=hazelcast,env=prod"
apiVersion: v1 kind: Pod metadata: name: hazelcast labels: app: hazelcast env: prod spec: containers: - env: - name: DNS_DOMAIN value: cluster image: hazelcast/hazelcast name: hazelcast ports: - containerPort: 5701
kubectl describe pods hazelcast
kubectl logs pod/hazelcast
kubectl exec -it hazelcast -- /bin/sh
apiVersion: v1 kind: Pod metadata: name: spring-boot-app spec: containers: - image: bmuschko/spring-boot-app:1.5.3 name: spring-boot-app env: - name: SPRING_PROFILES_ACTIVE value: prod - name: VERSION value: '1.5.3'
apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: mypod name: mypod spec: containers: - command: ["/bin/sh"] args: ["-c", "while true; do date; sleep 10; done"] image: busybox name: mypod resources: {} dnsPolicy: ClusterFirst restartPolicy: Never status: {}
kubectl delete pod nginx --grace-period=0 --force
apiVersion: v1 kind: Pod metadata: name: ckad-nginx spec: containers: - name: nginx image: nginx:1.17.10 ports: - containerPort: 80 env: - name: DB_URL value: postgresql://mydb:5432 - name: DB_USERNAME value: admin
apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: loop name: loop spec: containers: - args: - /bin/sh - -c - while true; do date; sleep 10; done image: busybox name: loop resources: {} dnsPolicy: ClusterFirst restartPolicy: Never status: {}
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments