This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
система_kubernetes [2026/05/22 12:25] val [cert-manager] |
система_kubernetes [2026/06/07 09:31] (current) val [Развертывание через Kubespray] |
||
|---|---|---|---|
| Line 595: | Line 595: | ||
| kube_control_plane | kube_control_plane | ||
| - | [kube_node] | + | [kube_node:children] |
| - | kube[1:3] | + | kube_control_plane |
| - | #kube[1:4] | + | |
| </code><code> | </code><code> | ||
| - | server:~# docker run --userns=host --rm -it -v /root/inventory/sample:/inventory -v /root/.ssh/:/root/.ssh/ quay.io/kubespray/kubespray:v2.29.0 bash | + | server:~# docker run --userns=host --rm -it -v /root/inventory/sample:/inventory -v /root/:/root/ quay.io/kubespray/kubespray:v2.29.0 bash |
| root@cf764ca3b291:/kubespray# ansible all -m ping -i /inventory/inventory.ini | root@cf764ca3b291:/kubespray# ansible all -m ping -i /inventory/inventory.ini | ||
| </code> | </code> | ||
| + | * [[Сервис Ansible#Использование ролей]] Ansible для настройки сети | ||
| + | |||
| + | * Может потребоваться | ||
| <code> | <code> | ||
| root@cf764ca3b291:/kubespray# cp -rv inventory/sample/group_vars/ /inventory/ | root@cf764ca3b291:/kubespray# cp -rv inventory/sample/group_vars/ /inventory/ | ||
| </code> | </code> | ||
| - | * Может потребоваться [[#Настройка registry-mirrors для Kubespray]] и [[#Добавление insecure_registries через Kubespray]] | + | * [[#Настройка registry-mirrors для Kubespray]] и [[#Добавление insecure_registries через Kubespray]] |
| <code> | <code> | ||
| root@cf764ca3b291:/kubespray# time ansible-playbook -i /inventory/inventory.ini cluster.yml | root@cf764ca3b291:/kubespray# time ansible-playbook -i /inventory/inventory.ini cluster.yml | ||
| Line 612: | Line 615: | ||
| real 12m18.679s | real 12m18.679s | ||
| ... | ... | ||
| + | </code> | ||
| + | === Удаление вышедшего из строя узла через kubespray === | ||
| + | |||
| + | <code> | ||
| + | root@3c29190fe4cb:/kubespray# time ansible-playbook -i /inventory/inventory.ini remove-node.yml -e "node=kubeN" -e "reset_nodes=false" -e "allow_ungraceful_removal=true" | ||
| + | ... yes | ||
| + | </code> | ||
| + | |||
| + | в случае первого мастер узла понадобится: | ||
| + | <code> | ||
| + | server:~# cat inventory/sample/inventory.ini | ||
| + | ... | ||
| + | [kube_control_plane] | ||
| + | kube2 | ||
| + | kube3 | ||
| + | kube1 | ||
| + | ... | ||
| + | |||
| + | ... ansible-playbook -i /inventory/inventory.ini remove-node.yml ... | ||
| + | |||
| + | |||
| + | kube2:~# kubectl get configmap -n kube-system -o yaml | grep X.221 | ||
| + | kube2:~# kubectl edit configmap cluster-info -n kube-public | ||
| + | kube2:~# kubectl edit configmap kubeadm-config -n kube-system | ||
| </code> | </code> | ||
| Line 680: | Line 707: | ||
| $ kubectl run my-debian --image=debian -- "sleep" "60" | $ kubectl run my-debian --image=debian -- "sleep" "60" | ||
| </code> | </code> | ||
| - | * [[#kube-state-metrics]] | + | * Еще примеры запуска в разделе [[#kube-state-metrics]] |
| <code> | <code> | ||
| $ kubectl get pods | $ kubectl get pods | ||
| Line 889: | Line 916: | ||
| $ kubectl describe -n my-ns pod/my-webd-NNNNNNNNNN-NNNNN | $ kubectl describe -n my-ns pod/my-webd-NNNNNNNNNN-NNNNN | ||
| + | $ kubectl -n my-ns logs deployments/my-webd | ||
| $ kubectl -n my-ns logs pod/my-webd-NNNNNNNNNN-NNNNN #-c load-htdocs-files | $ kubectl -n my-ns logs pod/my-webd-NNNNNNNNNN-NNNNN #-c load-htdocs-files | ||
| Line 1820: | Line 1848: | ||
| Setting->General | Setting->General | ||
| - | Pod Deletion Policy When Node is Down: delete-statefuset-pod | + | Pod Deletion Policy When Node is Down: delete-statefuset-pod или delete-both-statefulset-and-deployment-pod (по умолчанию do-nothing) |
| </code> | </code> | ||
| Line 3038: | Line 3066: | ||
| kubeN:~# etcdctl member list -w table \ | kubeN:~# etcdctl member list -w table \ | ||
| - | --endpoints=https://kube1:2379 \ | + | --endpoints=https://kubeN:2379 \ |
| --cacert=/etc/ssl/etcd/ssl/ca.pem \ | --cacert=/etc/ssl/etcd/ssl/ca.pem \ | ||
| --cert=/etc/ssl/etcd/ssl/node-kube1.pem \ | --cert=/etc/ssl/etcd/ssl/node-kube1.pem \ | ||