Skip to content

Instantly share code, notes, and snippets.

@benbonnet
Last active March 19, 2019 00:38
Show Gist options
  • Save benbonnet/79be660b9c5d03ed75bd0095f815da20 to your computer and use it in GitHub Desktop.
Save benbonnet/79be660b9c5d03ed75bd0095f815da20 to your computer and use it in GitHub Desktop.
kubernetes on Ubuntu 18.10
# Source : https://mherman.org/blog/setting-up-a-kubernetes-cluster-on-ubuntu/
# on all nodes
sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update && sudo apt install -qy docker-ce
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" > /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update && sudo apt-get install -y kubeadm kubelet kubectl
# On master
kubeadm init --apiserver-advertise-address=178.62.65.8 --pod-network-cidr=192.168.1.0/16
adduser deploy
usermod -aG sudo deploy
su - deploy
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl -n kube-system get deployment coredns -o yaml | \
sed 's/allowPrivilegeEscalation: false/allowPrivilegeEscalation: true/g' | \
kubectl apply -f -
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
## THEN NODES CAN JOIN...
@benbonnet
Copy link
Author

Digital ocean cloud config :

#cloud-config
runcmd:
  - sudo apt-get update && sudo apt-get install -y apt-transport-https
  - curl -s https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
  - sudo apt update && sudo apt install -qy docker-ce
  - 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" > /etc/apt/sources.list.d/kubernetes.list
  - sudo apt-get update && sudo apt-get install -y kubeadm kubelet kubectl

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