Skip to content

Instantly share code, notes, and snippets.

@mowings
Last active May 14, 2019 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mowings/6a6be82de06483d13014fa8e81692fdd to your computer and use it in GitHub Desktop.
Save mowings/6a6be82de06483d13014fa8e81692fdd to your computer and use it in GitHub Desktop.
Install Kubernetes at Digital Ocean using private networking

Install the software

Instructions mostly at https://vitux.com/install-and-deploy-kubernetes-on-ubuntu/ but be sure to read the notes below before starting.

additional setup

This document assumes all hosts are on the private network, and the hosts are configured to pass/allow all traffic on that network. You could tighten this up if you want, but k8 requires quite a range of ports be open.

Be sure the --apiserver-advertise-address=<private ip> parameter is passed to kubeadm init on any master host. By default, the api-server will attempt to advertise on the public interface.

Note that on digital ocean, and possibly anwhere you have more than one NIC, you will need to tell the nodes to use their private ip. On each host (including masters), edit/create /etc/default/kubelet and put in the line:

KUBELET_EXTRA_ARGS= --node-ip=<private ip>

By default kublet binds to the instance public IP which is no bueno.

Then systemd restart kubelet.service. Do this for all nodes

Do not blindly install flannel. You will need to make some changes to the config file. Specificlly, download the yaml file:

wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Then edit the file. Look for the DaemonSet/containers/kube-flannes section. Add the following to the list of startup args:

- --iface=eth1 # or whatever the private interface is

Then apply the yaml file:

kubectl apply -f kube-flannel.yml
# or kubectl delete -f kube-flannel.yml && kubectl apply -f kube-flannel.yml if you already went with the default

You can get the logs for each deployed flanne container (there wil be one per node) by getting all the flannel pods:

 kubectl get pods -o wide --all-namespaces | grep flannel

Then go grab the logs for each, and verify that it started with the correct -- private -- ip:

kubectl -n kube-system logs -c kube-flannel <pod name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment