Проверка статуса kubernetes

Скрипт проверки статуса kubernetes:

docker ps
kubectl get no
kubectl get po -A
kubectl -n kube-system get cm
kubectl -n kube-system get cm coredns -o yaml
calicoctl node status
Пример успешного ответа:

[ekb99-vk3-ctl03.dataflex.local: ~]# ./kube_check
CONTAINER ID        IMAGE                                                                  COMMAND                  CREATED             STATUS              PORTS               NAMES
b3e1419867fa        ekb99-vk3-dpl01.dataflex.local:5553/beats/metricbeat               "/usr/local/bin/dock…"   14 minutes ago      Up 14 minutes                           k8s_metricbeat_metricbeat-cms2t_kube-system_4301a2d2-924b-457e-89cc-b43bbce5647f_0
909bc85d9ea9        ekb99-vk3-dpl01.dataflex.local:5553/beats/filebeat                 "/usr/local/bin/dock…"   15 minutes ago      Up 15 minutes                           k8s_filebeat_filebeat-bgkfl_kube-system_889874b0-6240-43bc-acfd-ba9cddfc83e6_0
556fbafed13c        ekb99-vk3-dpl01.dataflex.local:5553/corpcloud/pause:3.1            "/pause"                 15 minutes ago      Up 15 minutes                           k8s_POD_metricbeat-cms2t_kube-system_4301a2d2-924b-457e-89cc-b43bbce5647f_0
14e7f23c84d4        ekb99-vk3-dpl01.dataflex.local:5553/corpcloud/pause:3.1            "/pause"                 15 minutes ago      Up 15 minutes                           k8s_POD_filebeat-bgkfl_kube-system_889874b0-6240-43bc-acfd-ba9cddfc83e6_0
cda5f7d8dcb6        6f674c890b23                                                           "start_runit"            15 minutes ago      Up 15 minutes                           k8s_calico-node_calico-node-qwhb5_kube-system_b401064e-79ac-4134-ba73-dc27bbaec2f8_1
5b47ff78e47d        ekb99-vk3-dpl01.dataflex.local:5553/corpcloud/k8s-dns-node-cache   "/node-cache -locali…"   15 minutes ago      Up 15 minutes                           k8s_node-cache_node-local-dns-k57lg_kube-system_034dd9ce-0c12-4893-94bc-7a431a26e6fe_0
bf9f160604fa        ekb99-vk3-dpl01.dataflex.local:5553/corpcloud/pause:3.1            "/pause"                 15 minutes ago      Up 15 minutes                           k8s_POD_node-local-dns-k57lg_kube-system_034dd9ce-0c12-4893-94bc-7a431a26e6fe_0
393c6e630926        ekb99-vk3-dpl01.dataflex.local:5553/corpcloud/pause:3.1            "/pause"                 15 minutes ago      Up 15 minutes                           k8s_POD_calico-node-qwhb5_kube-system_b401064e-79ac-4134-ba73-dc27bbaec2f8_0

NAME                                 STATUS   ROLES    AGE   VERSION
ekb99-vk3-ctl01.dataflex.local   Ready    <none>   16m   v1.17.4
ekb99-vk3-ctl02.dataflex.local   Ready    <none>   16m   v1.17.4
ekb99-vk3-ctl03.dataflex.local   Ready    <none>   15m   v1.17.4

NAMESPACE              NAME                                        READY   STATUS    RESTARTS   AGE
default                consul-sync-catalog-6b75fb4df7-lgxwp        1/1     Running   0          16m
kube-system            calico-kube-controllers-655c4c6464-2925k    1/1     Running   0          16m
kube-system            calico-node-fqjzl                           1/1     Running   0          16m
kube-system            calico-node-qwhb5                           1/1     Running   1          15m
kube-system            calico-node-tbkb5                           1/1     Running   0          16m
kube-system            coredns-5688ccd698-w8hw9                    1/1     Running   0          16m
kube-system            coredns-5688ccd698-zsfdz                    1/1     Running   0          16m
kube-system            filebeat-bgkfl                              1/1     Running   0          15m
kube-system            filebeat-hblc5                              1/1     Running   0          16m
kube-system            filebeat-jznzn                              1/1     Running   0          16m
kube-system            kube-state-metrics-84d984fdcf-j2vfm         1/1     Running   0          16m
kube-system            metricbeat-6966478b6-2qnbj                  1/1     Running   0          16m
kube-system            metricbeat-ccmj2                            1/1     Running   0          16m
kube-system            metricbeat-cms2t                            1/1     Running   0          15m
kube-system            metricbeat-rsgn8                            1/1     Running   0          16m
kube-system            node-local-dns-k57lg                        1/1     Running   0          15m
kube-system            node-local-dns-wsq5l                        1/1     Running   0          16m
kube-system            node-local-dns-wx954                        1/1     Running   0          16m
kubernetes-dashboard   dashboard-metrics-scraper-d9d55f77d-kptmf   1/1     Running   0          16m
kubernetes-dashboard   kubernetes-dashboard-dc9796fb5-kzcjg        1/1     Running   1          16m
kubernetes-dashboard   kubernetes-dashboard-dc9796fb5-zq8vz        1/1     Running   0          16m

NAME                                 DATA   AGE
calico-config                        9      16m
coredns                              1      16m
extension-apiserver-authentication   6      17m
filebeat-config                      1      16m
metricbeat-daemonset-config          1      16m
metricbeat-daemonset-modules         2      16m
metricbeat-deployment-config         1      16m
metricbeat-deployment-modules        1      16m
node-local-dns                       1      16m
apiVersion: v1
data:
  Corefile: |
    .:53 {
      errors
      health
      kubernetes kube in-addr.arpa ip6.arpa {
        pods insecure
        upstream 10.55.41.8
        fallthrough in-addr.arpa ip6.arpa
      }
      prometheus :9153
      ready :8181
      forward . 10.55.41.8
      cache 30
      loop
      reload
      loadbalance
      }
kind: ConfigMap
metadata:
  creationTimestamp: "2022-10-26T15:25:35Z"
  name: coredns
  namespace: kube-system
  resourceVersion: "355"
  selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
  uid: c96cc89b-43f1-477f-b2ca-966b701b8f2d
Calico process is running.

IPv4 BGP status
+---------------+---------------+-------+----------+-------------+
| PEER ADDRESS  |   PEER TYPE   | STATE |  SINCE   |    INFO     |
+---------------+---------------+-------+----------+-------------+
| 10.55.125.217 | node specific | up    | 15:26:47 | Established |
| 10.55.125.218 | node specific | start | 15:26:47 | Connect     |
+---------------+---------------+-------+----------+-------------+

IPv6 BGP status
No IPv6 peers found.

Удаление группы подов

kubectl -n rabbitmq delete --all po

Удаление одного пода

kubectl -n rabbitmq delete po rabbitmq-ceilometer-0