Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
68 views3 pages

Install Kubernetes (K8s) and Docker On Ubuntu 20.04

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

#swapoff -a

#nano /etc/fstab
#/swapfile none swap sw 0 0

#nano install.sh

apt-get update

apt-get install curl apt-transport-https docker.io -y

service docker restart

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

echo "deb http://apt.kubernetes.io/ kubernetes-xenial main"


>/etc/apt/sources.list.d/kubernetes.list

apt-get update

apt install kubeadm=1.20.0-00 kubectl=1.20.0-00 kubelet=1.20.0-00 -y

apt-mark hold kubeadm kubelet kubectl

lsmod | grep br_netfilter


sudo modprobe br_netfilter
sudo sysctl net.bridge.bridge-nf-call-iptables=1

sudo mkdir /etc/docker


cat <<EOF | sudo tee /etc/docker/daemon.json
{ "exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts":
{ "max-size": "100m" },
"storage-driver": "overlay2"
}
EOF

sudo systemctl enable docker


sudo systemctl daemon-reload
sudo systemctl restart docker
kubeadm init --pod-network-cidr=10.244.0.0/16

—-------------------------------------------------------------------------------------------------

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

export KUBECONFIG=/etc/kubernetes/admin.conf

#sudo kubectl apply -f


https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

On Master node

kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml


kubectl apply -f
https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.49.0/deploy/static/prov
ider/baremetal/deploy.yaml

https://www.letscloud.io/community/how-to-install-kubernetesk8s-and-docker-on-ubuntu-2004

—----------------------------------------------------------------------------------------------------------------------------
Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.


Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.5.10:6443 --token hnf4l8.6anh9150vcmou203 \


--discovery-token-ca-cert-hash
sha256:d3da3e8eb39e0906adea6bb134d38d68d0024ee8d83b67a5029162ccf9e070ae

You might also like