Skip to content

Instantly share code, notes, and snippets.

@egernst
Last active June 17, 2020 22:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egernst/7a60c0ade7ed870ee4daa210f2fd0ba9 to your computer and use it in GitHub Desktop.
Save egernst/7a60c0ade7ed870ee4daa210f2fd0ba9 to your computer and use it in GitHub Desktop.
Access kubernetes cluster via public IP
  • not feasible to 'advertise address' using the public IP, since none of the rest of the control plane components can access (ie, public IP is NAT'd and not available on the actual noe)
  • need to create a certificate so the public IP can access the cluster

sample kubeadm config:

---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
apiServer:
  certSANs:
  - <the public ip>

Then on your local machine:

scp user@publicip:/home/user/.kube/config ~/.kube/config

Then edit the config to reflect the public IP, ala: s#https://.*:6443#https://publicIP:6443#

Then you can kubectl all the things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment