# Go to CP node, it will output the token sudo kubeadm token create -> output gexp9v.w1oe77h0yyuls5nh # Still at CP node, it will output a secure key openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/ˆ.* //' -> output 6e7f23199360bba5fb80a98992913b417310b97718bb2fbf9ab99bd00b00e9b0 # Go to Worker node kubeadm join -token gexp9v.w1oe77h0yyuls5nh k8scp:6443 -discovery-token-ca-cert-hash sha256:6e7f23199360bba5fb80a98992913b417310b97718bb2fbf9ab99bd00b00e9b0Īnd voila, you have configured a Kubernetes cluster. Then join the cluster with kubeadm join with the token and key in the worker node. We will have to create a token with kubeadm join and generate a secure key from the control plane node (Note: not the current work node). To join worker node with control plane node. kubectl describe node | grep -i taint -> Default control plane will be set as NoSchedule To utilize it we have to remove the taint(For practice purpose) kubectl taint nodes -all /master- 3) Add Worker Nodeģ.1) Repeat the whole of step 1 (Ubuntu image preparation) For your second k8s node, it should be the worker node, so name it as follows: - Your name: k8swoker01 - Your server’s name: k8swoker01 - Pick a username: k8s - Choose a password: - Confirm your password: ģ.2) Repeat part of step 2 (Install Kubernetes in Ubuntu) - Tools installation - Container runtime interface installation - Kubernetes installation - Setup network (Note: To set IP address and hostname based on control plane node) For practicing purposes in this example, we will utilize the control plane by removing the taint NoSchedule. # Exit from the root account mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/nf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/configĬNI plugin is required to implement the Kubernetes network model. For this example, we are setting up Kube config with cluster-admin privileges. We are required to set up a Kube config to access the Kubernetes cluster. Running kubeadm init will create a control plane node kubeadm init -upload-certs | tee kubeadm-init.out ip addr show -> You will see output with 10.130.0.x that will be the NAT Network IpAddress vim /etc/hosts -> Add the following content 10.130.0.5 k8scp Setup the network so it will be easier to use the hostname rather than the IP address later. #Ubuntu virtualbox image download installvim /etc/apt//kubernetes.list -> Add the following content into kubernetes.list deb kubernetes-xenial main curl -s | apt-key add - apt-get update apt-get install -y kubeadm=1.22.1-00 kubelet=1.22.1-00 kubectl=1.22.1-00 apt-mark hold kubelet kubeadm kubectl kubectl is a command line tool that runs commands against the clusters. kubelet is a primary node agent that runs each node. kubeadm is a tool that we will be using to init control plane node and join worker node. You will require kubeadm, kubeletand kubectl when installing Kubernetes cluster nodes. modprobe overlay modprobe br_netfilter vim /etc/sysctl.d/k8s.conf -> Add the following content into k8s.conf -nf-call-iptables = 1 _forward = 1 -nf-call-ip6tables = 1 sysctl -system export OS=xUbuntu_20.04 export VER=1.22 export WEBSITE= echo "deb $WEBSITE/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VER/$OS/ /" | tee -a /etc/apt//cri-0.list curl -L $WEBSITE/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VER/$OS/Release.key | apt-key add - echo "deb $WEBSITE/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /" | tee -a /etc/apt//libcontainers.list curl -L $WEBSITE/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | apt-key add - apt-get update apt-get install -y cri-o cri-o-runc systemctl daemon-reload systemctl enable crio systemctl start crio systemctl status crio This example uses CRI-O however we can also install other container runtimes such as Docker that uses containerd. So, we will need to install a container runtime before installing Kubernetes. Kubernetes is a platform for container orchestration and CRI is a Kubernetes API that interacts with different container runtimes. #Ubuntu virtualbox image download upgradesudo -i apt-get update & apt-get upgrade -y apt-get install -y vimĢ.2) Container runtime interface installation We will install tools such as Vim, which we will use later when setting up the Kubernetes. Voila, the Ubuntu installation is complete.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |