ref:https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/
but the cmd result is(pod:two-containers status is NotReady ):
[root@devnet-master ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
busybox-1 1/1 Running 1 33d
local-volume-provisioner-k49c7 1/1 Running 0 29m
nginx 2/2 Running 1 21m
two-containers 1/2 NotReady 0 61m
the version is:
[root@devnet-master ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-12T14:18:45Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.1", GitCommit:"5e58841cce77d4bc13713ad2b91fa0d961e69192", GitTreeState:"clean", BuildDate:"2021-05-12T14:12:29Z", GoVersion:"go1.16.4", Compiler:"gc", Platform:"linux/amd64"}
describe pod result is : exec describe pod result image
apply yaml is: apply yaml image
apiVersion: v1
kind: Pod
metadata:
name: two-containers
spec:
restartPolicy: Never
volumes:
- name: shared-data
hostPath:
path: /data
containers:
- name: nginx-container
image: xxxxxx/nginx:1.0
volumeMounts:
- name: shared-data
mountPath: /usr/share/nginx/html
- name: debian-container
image: xxxxxx/debian:stable
volumeMounts:
- name: shared-data
mountPath: /pod-data
command: ["/bin/sh"]
args: ["-c", "echo Hello from the debian container > /pod-data/index.html"]
kubectl get pods
also indicates the
same that only container is in ready state out of two.