3.2 KiB
3.2 KiB
Kubernetes (Kuber) Documentation
Control Plane (CP)
- CP (Control Plane): The central management entity of the Kubernetes cluster.
- By default, the manager in Kubernetes does not directly handle any containers.
Kubernetes Manager Components
- Control Manager
- Scheduler
- API Server
- etcd (Database)
- Kubelet
Kubernetes Worker Components
- Kube Proxy
- Kubelet
Data Flow
- Kube Proxy and Kubelet communicate with the Kubernetes Manager for data handling.
Administration Tools
- kubeadm: Used for administration commands.
- kubectl: Used to manage nodes and services.
Kubernetes Setup
Step 1: Write Default Config
- Generate the default containerd configuration.
containerd config default > /etc/containerd/config.toml
Step 2: Modify Config
- Change
systemd_cgrouptotrue.vim /etc/containerd/config.toml - Restart the containerd service.
systemctl restart containerd
Step 3: Load Required Modules
- Load necessary kernel modules.
modprobe br_netfilter overlay lsmod | grep overlay # To verify the overlay module is loaded - Add the modules to load at boot.
Add the following lines:
vim /etc/modules-load.d/modules.confbr_netfilter overlay
Step 4: Enable IPv4 Forwarding
- Update Config File
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/' /etc/sysctl.conf && sysctl -p
Step 5: Install Required Packages
- Install necessary packages.
sudo apt install ca-certificates curl apt-transport-https conntrack -y
Step 6: Install Kubernetes Components
- Add Kubernetes keyring.
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg - Add Kubernetes to the sources list.
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list - Update package list and install Kubernetes components.
sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl - Hold the package versions.
sudo apt-mark hold kubelet kubeadm kubectl - Enable and start kubelet.
sudo systemctl enable --now kubelet
Step 7: Setup Network Protocol
- Initialize the Kubernetes cluster.
kubeadm init --apiserver-advertise-address <ip-interface> --pod-network-cidr 10.244.0.0/16 - Apply the Flannel CNI plugin for network management.
kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml - Configure kubectl for the current user.
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
Step 8: Generate Join Command
- Generate the command to join worker nodes to the cluster.
kubeadm token create --print-join-command
This command will print out a token and the complete command to be used on worker nodes to join them to the cluster.