Pods in Kubernetes

0 votes
Could somebody explain Pods in Kubernetes context?
Jul 12, 2019 in Kubernetes by Ruby
920 views

1 answer to this question.

0 votes

Pod is a single or bunch of containers that is controlled as a single application 

  • Containers inside the Pod operate closely together and share a common life cycle, but has to be scheduled on the same node. 

  • Pods are managed as a unit and share common environment wrt volume and IP address space.

  • Every Pods consists of master container that satisfies of balancing the workload among the other containers that facilitate to orchestrate other related tasks.

  • For example, a pod may have one container running the primary application server and a helper container pulling down files to the shared file system when changes are detected in an external repository. 

  • Users are recommended not to manage pods themselves, because they might miss few features specifically needed in applications. 

  • Users are advised to operate with the objects that use pod templates as base components and add additional functionality to them.

Use Secrets in Pods

To use Secrets inside Pods, choose to expose pods in environment variables or mount the Secrets as volumes.

In terms of accessing Secrets inside a Pod, add env section inside the container spec
 

// using access-token Secret inside a Pod
# cat 2-7-2_env.yaml
apiVersion: v1
kind: Pod
metadata:
   name: secret-pod-env
spec:
  containers:
  - name: ubuntu
    image: ubuntu
    command: ["/bin/sh", "-c", "while : ;do echo $ACCESS_TOKEN; sleep 10; done"]
    env:
        - name: ACCESS_TOKEN
          valueFrom:
            secretKeyRef:
              name: access-token
              key: 2-7-1_access-token
// create a pod
# kubectl create -f 2-7-2_env.yaml
pod "secret-pod-env" created

Below example, expose 2-7-1_access-token key in access-token Secret as ACCESS_TOKEN environment variable, and print it out through a while infinite loop .
 

// check stdout logs
# kubectl logs -f secret-pod-env
9S!g0U616456r
answered Jul 12, 2019 by Sirajul
• 59,230 points

Related Questions In Kubernetes

0 votes
2 answers

Restart pods when configmap updates in Kubernetes?

Use Deployments, and consider your ConfigMaps to ...READ MORE

answered Aug 31, 2018 in Kubernetes by Nilesh
• 7,060 points
7,633 views
0 votes
1 answer

Create kubernetes that manages pods in java

Fabric8's Kubernetes Client is using a generated ...READ MORE

answered Sep 5, 2018 in Kubernetes by Kalgi
• 52,350 points
588 views
0 votes
1 answer
+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,477 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,036 views
0 votes
1 answer

What all components is the Master server in Kubernetes made up of?

Kubernetes is a combination of multiple parts ...READ MORE

answered Jul 11, 2019 in Kubernetes by Sirajul
• 59,230 points
1,397 views
0 votes
1 answer

How to build a high availability cluster in Kubernetes?

Add nodes in a HA cluster in ...READ MORE

answered Jul 12, 2019 in Kubernetes by Sirajul
• 59,230 points
1,213 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