Eu tenho um cluster Kubernetes com 2 nós mestres e 3 nós de trabalho e também tenho um nó separadoHaproxyservidor comIP Público.
Por padrão, o kubeadm gera todos os certificados necessários para o cluster e os armazena em /etc/kubernetes/pki
De acordo com a documentação, podemos colocar um ou mais certificados personalizados e chaves relevantes em /etc/kubernetes/pki e executarinicialização do kubeadmcomando para gerar o restante dos certificados.https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/
Como meu cluster já está instalado e em execução, o comando init falhará com os erros de comprovação.
Então, segui as etapas abaixo para gerar os certificados e as configurações do Kubernetes
cd /etc/kubernetes/pki/
sudo rm ca.key ca.crt
sudo openssl genrsa -out ca.key 2048
sudo openssl req -x509 -new -nodes -key ca.key -subj "/CN=My Local CA" -days 10000 -out ca.crt
sudo kubeadm init phase certs all --control-plane-endpoint "haproxy_IP:6443"
cd /etc/kubernetes/
sudo rm admin.conf controller-manager.conf kubelet.conf scheduler.conf
sudo kubeadm init phase kubeconfig all --control-plane-endpoint "haproxy_IP:6443"
sudo rm $HOME/.kube/config
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Agora estou recebendo erros abaixo
kubectl obtém nós
Error from server (InternalError): an error on the server ("") has prevented the request from succeeding
openssl s_client -connect haproxy_IP:6443
CONNECTED(00000005)
write:errno=0
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 315 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
kubectl obtém nós --v=7
09:41:50.597844 31816 request.go:943] Got a Retry-After 1s response for attempt 8 to https://haproxy_IP:6443/api?timeout=32s
09:41:51.598061 31816 round_trippers.go:422] GET https://haproxy_IP:6443/api?timeout=32s
09:41:51.598112 31816 round_trippers.go:429] Request Headers:
09:41:51.598219 31816 round_trippers.go:433] Accept: application/json, */*
09:41:51.598504 31816 round_trippers.go:433] User-Agent: kubectl/v1.20.4 (linux/amd64) kubernetes/e87da0b
09:41:51.602249 31816 round_trippers.go:448] Response Status: in 3 milliseconds
09:41:51.602301 31816 request.go:943] Got a Retry-After 1s response for attempt 9 to https://haproxy_IP:6443/api?timeout=32s
09:41:52.602523 31816 round_trippers.go:422] GET https://haproxy_IP:6443/api?timeout=32s
09:41:52.602558 31816 round_trippers.go:429] Request Headers:
09:41:52.602572 31816 round_trippers.go:433] User-Agent: kubectl/v1.20.4 (linux/amd64) kubernetes/e87da0b
09:41:52.602585 31816 round_trippers.go:433] Accept: application/json, */*
09:41:52.605922 31816 round_trippers.go:448] Response Status: in 3 milliseconds
09:41:52.605980 31816 request.go:943] Got a Retry-After 1s response for attempt 10 to https://haproxy_IP:6443/api?timeout=32s
09:41:53.606187 31816 round_trippers.go:422] GET https://haproxy_IP:6443/api?timeout=32s
09:41:53.610028 31816 round_trippers.go:429] Request Headers:
09:41:53.610048 31816 round_trippers.go:433] Accept: application/json, */*
09:41:53.610059 31816 round_trippers.go:433] User-Agent: kubectl/v1.20.4 (linux/amd64) kubernetes/e87da0b
09:41:53.612676 31816 round_trippers.go:448] Response Status: in 2 milliseconds
09:41:53.612837 31816 cached_discovery.go:121] skipped caching discovery info due to an error on the server ("") has prevented the request from succeeding
09:41:53.613146 31816 helpers.go:216] server response object: [{
"metadata": {},
"status": "Failure",
"message": "an error on the server (\"\") has prevented the request from succeeding",
"reason": "InternalError",
"details": {
"causes": [
{
"reason": "UnexpectedServerResponse"
}
],
"retryAfterSeconds": 1
},
"code": 500
}]
F0413 09:41:53.613294 31816 helpers.go:115] Error from server (InternalError): an error on the server ("") has prevented the request from succeeding
Se eureiniciaro novo certificado e arquivos de configuração com meus certificados e arquivos de configuração anteriores, então tudofunciona bemsem problemas.
Então, suspeito que estou faltando alguma coisa na minha abordagem.
Aprecio muito as ideias ou experiências semelhantes relacionadas a este assunto.