Dolphin
Dolphin

Reputation: 39055

how to add the public ip to X509 certificate when access kubernetes api server

I am deployment a kubernetes v1.22.3 cluster using kubeadm, today when I access api-server from public domain, shows error like this:

2021/08/04 11:20:19 http: proxy error: x509: certificate is valid for 10.96.0.1, 172.29.217.209, not 107.124.83.31

10.96.0.1 is my kubernetes cluster ip address, 172.29.217.209 is my host internal ip address. 107.124.83.31 is my public domain ip address. how to add the public ip 107.124.83.31 into the certificate so that I could access api server from public domain?

Upvotes: 0

Views: 813

Answers (1)

wineinlib
wineinlib

Reputation: 520

you shoud add IPs and domains of APIServer to certSANs in ClusterConfiguration of kubeadm config and kubeadm init --config=<kubeadm-config-file>.

apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
apiServer:
  certSANs: ['localhost','127.0.0.1'] 
  ...

Upvotes: 4

Related Questions