-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from coolsvap/1.21
Update to 1.21 for Ubuntu
- Loading branch information
Showing
11 changed files
with
378 additions
and
221 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
BOX_IMAGE = "generic/ubuntu1804" | ||
SETUP_MASTER = true | ||
MASTER_IP = "192.168.26.10" | ||
POD_NW_CIDR = "10.244.0.0/16" | ||
KUBE_VERSION="1.21.1" | ||
|
||
$kubemasterscript = <<SCRIPT | ||
HOST_IP=`/sbin/ifconfig eth1 | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2` | ||
### init k8s | ||
kubeadm init --apiserver-advertise-address=${HOST_IP} --kubernetes-version=#{KUBE_VERSION} --pod-network-cidr=#{POD_NW_CIDR} --skip-token-print | ||
ip route add 10.96.0.0/16 dev eth1 src ${HOST_IP} | ||
mkdir -p $HOME/.kube | ||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | ||
sudo chown $(id -u):$(id -g) $HOME/.kube/config | ||
kubectl taint nodes --all node-role.kubernetes.io/master- | ||
kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml | ||
kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml | ||
echo | ||
echo "### COMMAND TO ADD A WORKER NODE ###" | ||
kubeadm token create --print-join-command --ttl 0 | ||
SCRIPT | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.box = BOX_IMAGE | ||
config.vm.box_check_update = false | ||
|
||
config.vm.provider "virtualbox" do |l| | ||
l.cpus = 2 | ||
l.memory = "4096" | ||
end | ||
|
||
config.vm.provision :shell, :path => "install-master.sh" | ||
|
||
config.hostmanager.enabled = true | ||
config.hostmanager.manage_guest = true | ||
# config.vm.network "public_network" | ||
|
||
if SETUP_MASTER | ||
config.vm.define "master" do |subconfig| | ||
subconfig.vm.hostname = "master" | ||
subconfig.vm.network :private_network, ip: MASTER_IP | ||
subconfig.vm.provider :virtualbox do |vb| | ||
vb.customize ["modifyvm", :id, "--cpus", "2"] | ||
vb.customize ["modifyvm", :id, "--memory", "4096"] | ||
end | ||
subconfig.vm.provision :shell, inline: $kubemasterscript | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/sh | ||
# Use this script to setup any node in your Kuberntes cluster | ||
# Either master or worker | ||
# Source: http://kubernetes.io/docs/getting-started-guides/kubeadm/ | ||
|
||
### setup terminal | ||
KUBE_VERSION=1.21.1 | ||
### Setting up background to operate Kubernetes | ||
echo 'colorscheme ron' >> ~/.vimrc | ||
echo 'set tabstop=2' >> ~/.vimrc | ||
echo 'set shiftwidth=2' >> ~/.vimrc | ||
echo 'set expandtab' >> ~/.vimrc | ||
echo 'source <(kubectl completion bash)' >> ~/.bashrc | ||
echo 'alias k=kubectl' >> ~/.bashrc | ||
echo 'alias c=clear' >> ~/.bashrc | ||
echo 'complete -F __start_kubectl k' >> ~/.bashrc | ||
sed -i '1s/^/force_color_prompt=yes\n/' ~/.bashrc | ||
|
||
#Turn off Swap | ||
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab | ||
swapoff -a | ||
|
||
rm -rf ~/.kube /etc/cni/net.d /etc/kubernetes /var/lib/etcd /var/lib/kubelet /var/run/kubernetes /var/lib/cni /opt/cni | ||
iptables -F | ||
|
||
apt-get update | ||
apt-get install wget apt-transport-https gnupg lsb-release -y | ||
|
||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | ||
cat <<EOF > /etc/apt/sources.list.d/kubernetes.list | ||
deb http://apt.kubernetes.io/ kubernetes-xenial main | ||
EOF | ||
|
||
### install k8s and docker | ||
apt-get remove -y docker.io kubelet kubeadm kubectl kubernetes-cni docker-ce | ||
apt-get autoremove -y | ||
systemctl daemon-reload | ||
|
||
apt-get update -y | ||
apt-get -y install linux-headers-$(uname -r) | ||
apt-get install -y etcd-client vim build-essential bash-completion binutils apparmor-utils docker.io kubelet=${KUBE_VERSION}-00 kubeadm=${KUBE_VERSION}-00 kubectl=${KUBE_VERSION}-00 kubernetes-cni=0.8.7-00 | ||
|
||
cat > /etc/docker/daemon.json <<EOF | ||
{ | ||
"exec-opts": ["native.cgroupdriver=systemd"], | ||
"log-driver": "json-file", | ||
"storage-driver": "overlay2" | ||
} | ||
EOF | ||
mkdir -p /etc/systemd/system/docker.service.d | ||
|
||
# Restart docker. | ||
systemctl daemon-reload | ||
systemctl restart docker | ||
|
||
# start docker on reboot | ||
systemctl enable docker | ||
|
||
docker info | grep -i "storage" | ||
docker info | grep -i "cgroup" | ||
|
||
systemctl enable kubelet && systemctl start kubelet | ||
|
||
#Pull images | ||
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.