Hello,
I’m trying to use the InitContainer in my yaml deployment file.
The issue I have is that my POD is stuck in Init status:
ubuntu@kuber1:~/project$ kubectl get pods
NAME READY STATUS RESTARTS AGE
init-5bfc7b8d44-8bzfm 0/1 Init:0/1 0 6m54s
I checked the pods with the following command and fou d out my initContainer has started:
kubectl describe pods init
Init Containers:
nginx:
Container ID: docker://0e7976a56e4e6ea477c377f21dbc38eec7cc2f9b807d4929bd8e218f512261ce
Image: nginx
Image ID: docker-pullable://nginx@sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68
Port: 80/TCP
Host Port: 0/TCP
State: Running
Started: Mon, 27 May 2019 20:59:20 +0000
Ready: False
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-c6wjs (ro)
But the other container doesn’t want to start:
Containers:
mongo5:
Container ID:
Image: audirline/thanh:10037
Image ID:
Port: 10037/TCP
Host Port: 0/TCP
State: Waiting
Reason: PodInitializing
Ready: False
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-c6wjs (ro)
Conditions:
Type Status
Initialized False
Ready False
ContainersReady False
PodScheduled True
Here is my yaml file:
ubuntu@kuber1:~/project$ more mongo7.deploy.txt
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: init
spec:
replicas: 1
template:
metadata:
labels:
app: test
spec:
containers:
-
image: “audirline/thanh:10037”
name: mongo5
ports:
-
containerPort: 10037
initContainers:
-
image: “nginx”
name: nginx
ports:
-
containerPort: 80
Can anyone help?
Thanks.