-
-
Save WooodHead/d4105db366ba2e9d15542760451d2254 to your computer and use it in GitHub Desktop.
Kubernetes Digital Ocean Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from https://www.linode.com/docs/applications/containers/how-to-deploy-nginx-on-a-kubernetes-cluster/ | |
# swap | |
swapoff -a | |
# hosts modify this to match the environment including all other cluster workers | |
echo '<PRIVATE IP> test-kube-master' >> /etc/hosts | |
echo '<PRIVATE IP> test-kube-worker-1' >> /etc/hosts | |
echo '<PRIVATE IP> test-kube-worker-2' >> /etc/hosts | |
# docker | |
apt install -y -q ebtables ethtool apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | |
apt update | |
apt install -y -q docker-ce | |
# kubernetes | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
apt update | |
# explicit version number | |
apt-get install -y -q kubelet=1.11.3-00 kubectl=1.11.3-00 kubeadm=1.11.3-00 | |
# initialize master | |
kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=<PRIVATE IP> | |
mkdir -p $HOME/.kube | |
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
chown $(id -u):$(id -g) $HOME/.kube/config | |
kubectl apply -f https://docs.projectcalico.org/v2.6/getting-started/kubernetes/installation/hosted/kubeadm/1.6/calico.yaml | |
# digital ocean ccm | |
git clone https://github.com/digitalocean/digitalocean-cloud-controller-manager.git | |
export DIGITALOCEAN_ACCESS_TOKEN=<DIGITALOCEAN ACCESS TOKEN> | |
bash ./digitalocean-cloud-controller-manager/scripts/generate-secret.sh | |
# then add the configuration manually | |
# kubectl apply -f ./digitalocean-cloud-controller-manager/releases/v0.1.7.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from https://www.linode.com/docs/applications/containers/how-to-deploy-nginx-on-a-kubernetes-cluster/ | |
# swap | |
swapoff -a | |
# hosts modify this to match the environment including all other cluster workers | |
echo '<PRIVATE IP> test-kube-master' >> /etc/hosts | |
echo '<PRIVATE IP> test-kube-worker-1' >> /etc/hosts | |
echo '<PRIVATE IP> test-kube-worker-2' >> /etc/hosts | |
# docker | |
apt install -y -q ebtables ethtool apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | |
apt update | |
apt install -y -q docker-ce | |
# kubernetes | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
apt update | |
# explicit version number | |
apt-get install -y -q kubelet=1.11.3-00 kubectl=1.11.3-00 kubeadm=1.11.3-00 | |
# join the cluster - copy this over from the master once it is initialized | |
# kubeadm join <MASTER PRIVATE IP>:6443 --token <KUBE TOKEN> --discovery-token-ca-cert-hash <CERT HASH> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment