Created
May 14, 2020 14:57
-
-
Save 0x646e78/36db4851792f42fce84271627993a682 to your computer and use it in GitHub Desktop.
Almost Kube
This file contains 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
#!/usr/bin/env bash | |
swapoff -a | |
sed -i 's/^.*swap.*$//g' /etc/fstab | |
apt-get update | |
apt-get install -y vim apt-transport-https curl ca-certificates software-properties-common gnupg2 | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - | |
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
deb https://apt.kubernetes.io/ kubernetes-xenial main | |
EOF | |
add-apt-repository \ | |
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) \ | |
stable" | |
apt-get update | |
apt-get install -y kubelet kubeadm kubectl \ | |
containerd.io=1.2.13-1 \ | |
docker-ce=5:19.03.8~3-0~ubuntu-$(lsb_release -cs) \ | |
docker-ce-cli=5:19.03.8~3-0~ubuntu-$(lsb_release -cs) | |
apt-mark hold kubelet kubeadm kubectl | |
cat > /etc/docker/daemon.json <<EOF | |
{ | |
"exec-opts": ["native.cgroupdriver=systemd"], | |
"log-driver": "json-file", | |
"log-opts": { | |
"max-size": "100m" | |
}, | |
"storage-driver": "overlay2" | |
} | |
EOF | |
mkdir -p /etc/systemd/system/docker.service.d | |
systemctl daemon-reload | |
systemctl restart docker kubelet | |
kubeadm config images pull |
This file contains 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
Vagrant.configure("2") do |config| | |
config.vm.define "k8smaster" do |k8smaster| | |
k8smaster.vm.box = "generic/ubuntu1804" | |
k8smaster.vm.hostname = "k8smaster" | |
k8smaster.vm.network "private_network", ip: "192.168.10.2" | |
k8smaster.vm.provider "vmware_fusion" do |v| | |
v.memory = 6144 | |
v.cpus = 3 | |
end | |
end | |
config.vm.define "k8sworker1" do |k8sworker1| | |
k8sworker1.vm.box = "generic/ubuntu1804" | |
k8sworker1.vm.hostname = "k8sworker1" | |
k8sworker1.vm.network "private_network", ip: "192.168.10.3" | |
k8sworker1.vm.provider "vmware_fusion" do |v| | |
v.memory = 4096 | |
v.cpus = 2 | |
end | |
end | |
config.vm.box_check_update = false | |
config.vm.provision "shell", path: "provision.sh" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sets up a Master and Worker node ready to have kubernetes initialised.
/etc/hosts will need to be updated on worker to add k8shost
Then follow from here:
https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#instructions