How to check the status of individual pods and containers in ADCampus 5.3

2021-09-26 20:21:25 Published
  • -1 Followed
  • 0Collected ,1327Browsed

Network Topology

none

Problem Description


How to check the status of individual pods and containers

Process Analysis

1.View node status in the background“kubectl get node”.


2.Open all pods in the background,“kubectl get pod -A”,Add this parameter “-o wide”to see the IP and node where the pod is located.


2.Open campus-related pods in the background,“kubectl get pod -A | grep campus”


Filtering other pods is the same, such as filtering topology-related pods


3. View all pods that are running “kubectl get pod -A | grep Running”


View all pods that are not running, “kubectl get pod -A | grep -v Running”,this command is suitable for us to check which pods are not running properly


“kubectl get pod -A -o wide | grep -v Running | wc –l”, this command can view the number of pods that are not runningWhen the server restarts, the pods will start one after another, as shown below


4. The pod needs to be restarted. For example, if I go to restart the topology pod, first find the namespace and type of the topology pod, and execute the command “kubectl delete pod topology-be-deployment-6f6656d6dc-p5hxh -n campus” to delete the pod, and the system will automatically recreate a new one Pod, you can see that the newly created pod has a new namespace, and the running time is restarted.


5. Enter topology-related pod commands,“kubectl exec -it topology-be-deployment-6f6656d6dc-d8q7t -n campus bash” execute exit to log out.


Enter the container command, “docker exec -it 31b9565d58c5 bash”


Check whether the pod's internal network is reachable to the outside.


6. In addition, let’s talk about the relationship between pod and container, Pod can be thought of as a basket, and the container is the eggs in the basket. The relationship between them is mainly realized as the following points

1) How many resources a container can have in a pod also depends on the size of the basket.

2)The label is also attached to the basket.

3) The IP is assigned to the basket instead of the container, and all containers in the basket share this IP. (Pod is the basic unit for the allocation of network resources such as IP. This IP and its corresponding network namespace are shared by the containers in the pod;)

4) Even if there is only one egg (container), Kubernetes will still allocate a basket to it.

5)The containers in the pod share the network namespace, and share part of the storage through the volume mechanism.

6)The pause container has an ip address and a storage volume. Other containers in the pod share the ip address and storage of the pause container, so that file sharing and mutual trust are achieved.

the difference:

A pod is the smallest unit of k8s. The container is contained in a pod. A pod has a pause container and several business containers. The container is a single container. In short, a pod is a group of containers, and a container refers to one container.

Take the topology-related pod in campus as an example. There is one topology-related pod and two containers. These two containers have the same namespace, "topology-be-deployment-6f6656d6dc-p5hxh" and type "campus"


Solution

Refer to process analysis

Please rate this case:   
0 Comments

No Comments

Add Comments: