Overview
- Install and pin kubeadm, kubelet, and kubectl (v1.26.0 used in this lab).
- Configure kernel networking and container runtime prerequisites.
- Initialize the control-plane with kubeadm.
- Join the worker node with the kubeadm join command.
- Deploy Flannel for pod networking and validate node readiness.
Prerequisites (run on both control-plane and node01)
Recommended references:
- Kubernetes docs: https://kubernetes.io/docs/
- Flannel releases: https://github.com/flannel-io/flannel/releases
If your distribution is older (for example Ubuntu < 22.04 or Debian < 12), the
/etc/apt/keyrings directory may not exist. Create it before attempting to download the GPG key (see step 2).1) Configure kernel networking settings (both nodes)
Enable bridge netfilter and allow IPv4 forwarding. Run this on both control-plane and node01:- Some sysctl keys may be reported as ignored depending on the environment; the key point is to enable the bridge netfilter and IP forwarding settings.
2) Add Kubernetes APT repository and install kubeadm, kubelet, kubectl (both nodes)
Update apt and install supporting packages, create/etc/apt/keyrings if necessary, add the Google Cloud GPG key, and add the Kubernetes apt source:
- You may see APT warnings about duplicate sources — this is non-fatal.
- Some environments include policy scripts that prevent services from starting during package install (e.g.,
/usr/sbin/policy-rc.d returned 101). kubeadm will still configure kubelet appropriately.
3) Verify kubectl behavior before init (control-plane)
Before the control-plane is initialized,kubectl will not be able to reach the API server:
kubeadm init):
4) Initialize the control-plane with kubeadm (control-plane only)
- Find the IP address of the interface you will advertise (example uses
eth0):
- Initialize the control-plane. Set
--apiserver-advertise-addressto the control-plane IP and set--pod-network-cidrto the CIDR required by your CNI (Flannel uses10.244.0.0/16in this lab):
--pod-network-cidr to the pod network plugin you plan to install.
- After
kubeadm initcompletes, configure kubeconfig for your user:
- Confirm the control-plane node is visible (it will initially be NotReady until the pod network is installed):
- Save the
kubeadm joincommand thatkubeadm initprints. Example:
5) Join node01 to the cluster (node01 only)
On node01, run thekubeadm join command copied from the control-plane output. Example:
6) Install Flannel pod network (control-plane)
Apply the Flannel manifest from the official Flannel releases. Run this on the control-plane where kubeconfig is configured:kube-system namespace in Running or Completed state. After the network is ready, nodes should transition to Ready:
7) Quick validation commands
- List nodes:
- List all pods across namespaces:
- View kube-system resources (includes Flannel, kube-proxy, etc.):
Summary
- Enabled required kernel networking settings and applied sysctl configuration.
- Added Kubernetes APT repository and installed kubeadm, kubelet, and kubectl pinned at v1.26.0.
- Initialized the control-plane with
kubeadm initand configured kubeconfig. - Joined a worker node using the
kubeadm joincommand. - Deployed the Flannel CNI manifest and validated nodes became
Ready.
- Kubernetes kubeadm: https://kubernetes.io/docs/reference/setup-tools/kubeadm/
- Flannel GitHub: https://github.com/flannel-io/flannel
- Kubernetes networking: https://kubernetes.io/docs/concepts/cluster-administration/networking/