Kubernetes What are init conatiners

0 votes
can somebody explain what are init containers in kubernetes context?
Jul 23, 2019 in Kubernetes by Liana
623 views

1 answer to this question.

0 votes

Generally, in Kubenetes, a pod can have many containers. 

Init container gets executed before any other containers run in the pod.

apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
  labels:
    app: myapp
  annotations:
    pod.beta.Kubernetes.io/init-containers: '[
        {
            "name": "init-myservice",
            "image": "busybox",
            "command": ["sh", "-c", "until nslookup myservice; do echo waiting for myservice; sleep 2; done;"]
        }
    ]'
spec:
  containers:
  - name: myapp-container
    image: busybox
    command: ['sh', '-c', 'echo The app is running! && sleep 3600']
answered Jul 23, 2019 by Sirajul
• 59,230 points

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer

What are selector based selectors in Kubernetes?

This type of selector allows filtering keys ...READ MORE

answered Apr 17, 2019 in Kubernetes by Kim
1,475 views
+2 votes
3 answers

Error while doing kubernetes-init command

The reason that it mentions the port ...READ MORE

answered Sep 6, 2018 in Kubernetes by Kalgi
• 52,350 points
24,963 views
0 votes
1 answer

What is unknown user client in kubernetes?

I think your Legacy Authorisation has been ...READ MORE

answered Sep 12, 2018 in Kubernetes by DareDev
• 6,890 points
798 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,572 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,061 views
0 votes
1 answer

What are the container hooks available in kubernetes?

The hooks enable Containers to be aware ...READ MORE

answered Jul 15, 2019 in Kubernetes by Sirajul
• 59,230 points
2,210 views
0 votes
1 answer

Kubernetes: What are the types of multi-container pod patterns?

Here are the different types of multi-container ...READ MORE

answered Jul 17, 2019 in Kubernetes by Sirajul
• 59,230 points
2,392 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP