Exercise 4.6: Simple initContainer
Pod 생성
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: Pod metadata: name: init-tester spec: containers: - name: webservice image: nginx initContainers: - name: failed image: busybox command: [/bin/false] EOFPod 상태 추적
kubectl get pod init-tester -wCtrl+C 입력
Pod 상세내용 확인
kubectl describe pod init-testerPod 삭제
kubectl delete pod init-testerPod 생성
cat <<EOF | kubectl apply -f - apiVersion: v1 kind: Pod metadata: name: nginx-init spec: containers: - name: nginx image: nginx ports: - containerPort: 80 volumeMounts: - name: html mountPath: /usr/share/nginx/html initContainers: - name: index image: curlimages/curl command: - "sh" - "-c" - "echo Welcome to LFD459 > /data/index.html" volumeMounts: - name: html mountPath: /data volumes: - name: html emptyDir: {} EOFPod 상태 확인
kubectl get pod nginx-initPod 상세내용 확인
kubectl describe pod nginx-initCURL 명령어를 통해서 생성된 Pod의 IP주소로 HTTP 요청
curl $(kubectl get pod nginx-init -o=jsonpath='{.status.podIP}')Pod 삭제
kubectl delete pod nginx-init
PreviousExercise 4.5: Setting Pod Resource Limits and RequirementsNextExercise 4.7: Exploring Custom Resource Definitions
Last updated