0% found this document useful (0 votes)
15 views4 pages

K8s Installation

The document provides a step-by-step guide for setting up Kubernetes using Kubeadm, including configuration for containerd and necessary system settings. It details the installation of Kubeadm, Kubectl, and Kubelet, along with the creation of a Kubernetes cluster and the deployment of a pod network. Additionally, it includes instructions for joining worker nodes to the cluster and checking the status of services.

Uploaded by

gegoyo9715
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

K8s Installation

The document provides a step-by-step guide for setting up Kubernetes using Kubeadm, including configuration for containerd and necessary system settings. It details the installation of Kubeadm, Kubectl, and Kubelet, along with the creation of a Kubernetes cluster and the deployment of a pod network. Additionally, it includes instructions for joining worker nodes to the cluster and checking the status of services.

Uploaded by

gegoyo9715
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

https://kubernetes.

io/docs/setup/production-environment/tools/kubeadm/install-
kubeadm/

1)

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf


br_netfilter
EOF

2)

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf


net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

3)

sudo sysctl --system

Container D Set up
===================

4)

cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf


overlay
br_netfilter
EOF

6)
sudo modprobe overlay
7)
sudo modprobe br_netfilter

8)
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

9)
sudo sysctl --system

10)
sudo apt-get update
sudo apt install containerd -y

11)
sudo mkdir -p /etc/containerd

12)
containerd config default | sudo tee /etc/containerd/config.toml

13)
sudo systemctl restart containerd
14)

Add 2 Lines:

sudo vim /etc/containerd/config.toml

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
...Add Below
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true

15)
sudo systemctl restart containerd

16) Install Kubeadm Kubectl kubelet


===============================

1) sudo apt-get update

3)(not required atm still in testing) sudo curl -fsSLo


/usr/share/keyrings/kubernetes-archive-keyring.gpg
https://packages.cloud.google.com/apt/doc/apt-key.gpg

4)(not required atm still in testing) echo "deb


[signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg]
https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee
/etc/apt/sources.list.d/kubernetes.list

5) sudo apt-get update


6) sudo apt-cache policy kubelet | head -n 20

7)VERSION=1.24.0-00

"Commands from chat gpt working


1)sudo apt update
2)sudo apt install -y apt-transport-https ca-certificates curl software-properties-
common
3)curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
-
4)echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee
/etc/apt/sources.list.d/kubernetes.list
5)sudo apt update
6)sudo apt install -y kubelet kubeadm kubectl (can use 9th also)
After this go 10th step below
"

8) sudo apt-get update


9) sudo apt-get install -y kubelet=$VERSION kubeadm=$VERSION kubectl=$VERSION
10) sudo apt-mark hold kubelet kubeadm kubectl

11) sudo systemctl status kubelet.service


12) sudo systemctl status containerd.service
13) sudo systemctl enable kubelet.service
14) sudo systemctl enable containerd.service
15) ls -l /proc/sys/net/ipv4/ip_forward
16) echo 1 > /proc/sys/net/ipv4/ip_forward

AMI is created after all the above steps


=======================================================================
https://docs.projectcalico.org/getting-started/kubernetes/self-managed-onprem/
onpremises

Only On Master Node:


===================

2) kubeadm config print init-defaults| tee ClusterConfiguration.yaml

3) Open a File Do Below Changes (ClusterConfiguration.yaml)

a) advertiseAddress: 172.31.37.112 (localAPIEndpoint: Master Node IP)

b) criSocket: /run/containerd/containerd.sock

c) kubernetesVersion: v1.22.1

d) Add Below Line (End of The File)

---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd

4) Create Cluser

sudo kubeadm init --config=ClusterConfiguration.yaml

5) Copy Step4 cmd output into Notepad

6) curl https://docs.projectcalico.org/archive/v3.20/manifests/calico.yaml -O

kubectl apply -f calico.yaml

To check if calico is running

kubectl get pods -n kube-system

-----------------------------------------------------------
For calico december 2023
kubectl create -f
https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/tigera-
operator.yaml

kubectl create -f
https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/custom-
resources.yaml
--------------------------------
testing not needed

---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd

7gnc7
-=-------------------------

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:

sudo kubeadm join 172.31.43.22:6443 --token abcdef.0123456789abcdef \


--discovery-token-ca-cert-hash
sha256:0b4e8ec11592499abb6c565bec59128a7e2704f18ace34f7455d0a6704f021ae

kubeadm join 172.31.37.70:6443 --token nf08t4.1ryarbja178bghgs --discovery-token-


ca-cert-hash
sha256:af66a41812e0ce33ef4579e84f0ffb91953278c93aa3191973d59297088bc945

You might also like