Introduction to k8s api-resources resource type

1. View the resource cluster status in the k8s cluster environment

Enter the command=》# kubectl api-resources to  display all api resource information in the k8s cluster, parameter description:

  • NAME: api resource name;
  • SHORTNAMES: abbreviation of api resource name;
  • APIGROUP: api group management;
  • NAMESPACED: Whether namespace isolation can be used, true is true, false is not;
  • KIND: api resource type;

View k8s component cluster status=》# kubectl get cs

= "[Kubeadm installs k8s component controller-manager and scheduler status Unhealthy] error:

The above Unhealthy status appears, troubleshooting ideas:

1|1. Check the local port first, and you can confirm that ports 10251 and 10252 are not activated

=》# sudo netstat -tlunp

 Or directly filter to view ports 10251 and 10252

  • =》# Ss -ant | grep 10251
  • =》# Ss -ant | grep 10252

1|2, confirm whether non-secure ports are disabled in the kube-scheduler and kube-controller-manager component configuration

 = "Configuration file path:

  • /etc/kubernetes/manifests/kube-scheduler.conf 
  • /etc/kubernetes/manifests/kube-controller-manager.conf

 = "View the corresponding ymal file:

vim /etc/kubernetes/manifests/kube-scheduler.yaml
vim /etc/kubernetes/manifests/kube-controller-manager.yaml

 = "Remove the setting of --port=0, in the red box as shown below:

1 | 3. 重启 kubelet =》# sudo systemctl restart kubelet

After restarting the service, confirm the component status, the display is normal, and enter the following command again to verify:

  • View cluster monitoring port information=》# sudo netstat -tlunp
  • View master component status =》# kubectl get cs

 

2. Common api resource view commands

  • View master component status=》# kubectl get cs
  • View node status=》# kubectl get node
  • View the URL of the Apiserver proxy =》# kubectl cluster-info
  • View cluster details=》# kubectl cluster-info dump 
  • View resource information=》# kubeclt describe <resource> <name> 
  1. View node details=》# kubectl describe node
  2. View master node details=》# kubectl describe node k8s-master
  3. View node node details=》# kubectl describe node k8s-node01
  • View Pod resource information=》# kubectl get pod <Pod name> --watch

The role of api-server:

  • Unified entrance to the cluster;
  • Cooperate with other components (there are some api agents inside);

 

to sum up:

  • api-resources View cluster resource type information;
  • After kubeadm installs the k8s cluster, check the status of the master node components;
  • A brief introduction to commonly used api-resources;

Guess you like

Origin blog.csdn.net/ChaITSimpleLove/article/details/110455619