Created
April 19, 2020 13:15
-
-
Save marciodf/af0d8e4eef571702b0db265e5ff5551e to your computer and use it in GitHub Desktop.
Kubernetes DIY
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
#/* ****************Master.sh **************** */ | |
#/* bash Master.sh | tee ~/master.out | |
#!/bin/bash -x | |
## Abril 2020 | |
echo "Ubuntu 18.04" | |
sleep 3 | |
echo | |
echo "Disable swap until next reboot" | |
echo | |
sudo swapoff -a | |
echo "Update the local node" | |
sudo apt-get update && sudo apt-get upgrade -y | |
echo | |
echo "Install Docker" | |
sleep 3 | |
sudo apt-get install -y docker.io | |
echo | |
echo "Install kubeadm, kubelet, and kubectl" | |
sleep 3 | |
sudo sh -c "echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >> /etc/apt/sources.list.d/kubernetes.list" | |
sudo sh -c "curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -" | |
sudo apt-get update | |
sudo apt-get install -y kubeadm=1.17.1-00 kubelet=1.17.1-00 kubectl=1.17.1-00 | |
sudo apt-mark hold kubelet kubeadm kubectl | |
echo | |
echo "Installed - now to get Calico Project network plugin" | |
## If you are going to use a different plugin you'll want | |
## to use a different IP address, found in that plugins | |
## readme file. | |
sleep 3 | |
sudo kubeadm init --kubernetes-version 1.17.1 --pod-network-cidr 192.168.0.0/16 | |
sleep 5 | |
echo "Running the steps explained at the end of the init output for you" | |
mkdir -p $HOME/.kube | |
sleep 2 | |
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
sleep 2 | |
sudo chown $(id -u):$(id -g) $HOME/.kube/config | |
echo "Download Calico plugin and RBAC YAML files and apply" | |
wget https://tinyurl.com/yb4xturm -O rbac-kdd.yaml | |
wget https://tinyurl.com/y2vqsobb -O calico.yaml | |
kubectl apply -f rbac-kdd.yaml | |
kubectl apply -f calico.yaml | |
echo | |
echo | |
sleep 3 | |
echo "You should see this node in the output below" | |
echo "It can take up to a mintue for node to show Ready status" | |
echo | |
kubectl get node | |
echo | |
echo | |
echo "Script finished. Move to the next step" |
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
#!/bin/bash | |
#/* **************** k8sSecond.sh **************** */ | |
#/* | |
# * | |
# */ | |
#!/bin/bash -x | |
## TxS abril 2020 | |
## | |
echo " This script is written to work with Ubuntu 18.04" | |
echo | |
sleep 3 | |
echo " Disable swap until next reboot" | |
echo | |
sudo swapoff -a | |
echo " Update the local node" | |
sleep 2 | |
sudo apt-get update && sudo apt-get upgrade -y | |
echo | |
sleep 2 | |
echo " Install Docker" | |
sleep 3 | |
sudo apt-get install -y docker.io | |
echo | |
echo " Install kubeadm, kubelet, and kubectl" | |
sleep 2 | |
sudo sh -c "echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' >> /etc/apt/sources.list.d/kubernetes.list" | |
sudo sh -c "curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -" | |
sudo apt-get update | |
sudo apt-get install -y kubeadm=1.17.1-00 kubelet=1.17.1-00 kubectl=1.17.1-00 | |
sudo apt-mark hold kubelet kubeadm kubectl | |
echo | |
echo " Script finished. You now need the kubeadm join command" | |
echo " from the output on the master node" | |
echo | |
# */ student@ckad-2:~$ sudo kubeadm join --token 118c3e.83b49999dc5dc034 10.128.0.3:6443 --discovery-token-ca-cert-hash sha256:40aa946e3f53e38271bae24723866f5 | |
# */ student@ckad-1:~$ source <(kubectl completion bash) | |
# */ student@ckad-1:~$ echo "source <(kubectl completion bash)" >> ~/.bashrc | |
# */ kubectl describe nodes | grep -i Taint | |
# */ kubectl taint nodes --all node-role.kubernetes.io/master- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment