Friday, August 23, 2024

Kubernetes - Pods [Part 2]

 


We can update a label on any Kubernetes object using label command.

#kubectl label pods podname labelname

label will not not overwriting existing label by default. We can overwriting existing label through --overwrite flag.

Removing the label on the object.

#kubectl label pods podname labelname-

Logging into Pods for interactive session.

#kubectl exec -it podname -- bash

#kubectl attach -it podname

Definition of Pods:

Kubernetes groups multiple containers into atomic group is called Pod. Pod is a smallest deployable artifact in a Kubernetes cluster. This means all of the container in the pod will be land on the same virutal machine. Each container in a pod has a different cgroup, but share a number of Linux namespaces.

The containers are sharing with IP address along with port space (Network space) and have a same hostname (UTS namespace) and communicative native interprocess communication channel over System V IPC or POSIX message queue.

Creating Pods:

#kubectl run kuard  --image=gcr.io/kuar-demo/kuard-amd64:blue

We will get a more information about the pods through describe flag.

#kubectl describe pod kuard

Create a annotation of pod

#kubectl annotate pod kuard descriptions="testing Pod"

Delete a pods from Kubernetes cluster.

#kubectl delete pods/kuard

Creating  a pod through yaml file:

apiVersion: v1

kind: Pod

metadata:

  name: kuard

spec:

  containers:

    - image: gcr.io/kuar-demo/kuard-amd64:blue

      name: kuard

      ports:

        - containerPort: 8080

          name: http

No comments:

Post a Comment