Exercise 4.6: Simple initContainer
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] EOFkubectl get pod init-tester -wkubectl describe pod init-testerkubectl delete pod init-testercat <<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: {} EOFkubectl get pod nginx-initkubectl describe pod nginx-initcurl $(kubectl get pod nginx-init -o=jsonpath='{.status.podIP}')kubectl delete pod nginx-init
PreviousExercise 4.5: Setting Pod Resource Limits and RequirementsNextExercise 4.7: Exploring Custom Resource Definitions
Last updated