Question-86: How do you define the tags for Kubernetes objects?

Answer: You can define the tags using Labels and annotation to a Kubernetes object. You can use below command for applying/updating tag

“kubectl label pods hepod author=hadoopexam”

In above command it would add the label “author=hadoopexam” to a pod which has name as “hepod”

Question-87: How can you run the bash command in a running container?

Answer: You can use exec command to execute command in a running container as below

                “kubectl exec -it hepod –bash

Above command would give you an interactive shell inside the running container, which would help you to interact with container.

Question-88: How can you send input to running process from standard input?

Answer: You can use “attach” option. Using this you can send input to the running process and if your running process can read data from standard input then it will read this.

Question-89: What you have to do, when you want to access your pod via network?

Answer: Then you have to use port-forward command and this will forward network traffic from the local machine to the Pod. And this is the best way to enable secure traffic which is not exposed to public network. You have to use following command

“kubectl port-forward hePOD 8080:80”

This will open connection and forward traffic from local machine on port 8080 to the remote container 80.

Question-90: What is pod?

Answer: Kubernetes groups multiple containers and create a single unit that is known as Pod. Pod is a collection of application containers and volumes running in the same execution environment. And you should know that pod is a smallest unit which is deployed as a smallest unit on a Kubernetes cluster. And now you can think that all the containers of the same pod are deployed on the same machine.