Initialize First Master Node

Dependency

A master node can be one, three, five, and so on, but always an odd number. Having an odd number of control plane nodes helps with leader selection in the case of a machine or zone failure. Creating Highly Available Clusters with kubeadm

kube-vip is an open-source project that aims to simplify providing load balancing services for Kubernetes clusters. Kube-VIP docs

Enable kubectl auto-completion for bash

Ensure that the kubectl completion script gets sourced in all your shell sessions

Extend shell completion to work with alias-k

Prepare Kube-Vip Configuration

Generate kube-vip manifest

Create a directory for storing the coming config files

Scan and reserve the available IPs for virtual IP address (VIP)

To examine the name of network interface

Set the VIP to the available IP address that will be used for the control plane load balancer VIP

Set the INTERFACE name to the name of the interface on the control plane(s) that will announce the VIP. In many Linux distributions, this can be found using the ip addr command.

Get the latest version of the kube-vip release by parsing the GitHub API. This step requires the Linux packages jq and curl.

Create the alias of kube-vip docker container program

Create APR config file

This configuration will create a manifest that starts kube-vip, providing control plane VIP and Kubernetes Service management using the leaderElection method and ARP. When this instance is elected as the leader, it will bind the VIP to the specified INTERFACE. This is the same behaviour for Services of type LoadBalancer

Customize kube-vip manifest

Edit the kube-vip.yaml to custom the config

The load balancing is provided through IPVS (IP Virtual Server) and provides a Layer 4 (TCP-based) round-robin across all of the control plane nodes. By default, the load balancer will listen on the default port of 6443 as the Kubernetes API server. The IPVS virtual server lives in kernel space and doesn't create an "actual" service that listens on port 6443. This allows the kernel to parse packets before they're sent to an actual TCP port. This is important to know because it means we don't have any port conflicts having the IPVS load balancer listening on the same port as the API server on the same host. Control Plane Load-Balancing

Disable svc_enable by set the value to false, to prevent conflict with other service load-balancer in future. Enable lb_enable, by append lb_enable and lb_port, then set to true and 6443, respectively.

Init Kubernetes cluster

Append master nodes and vip host into hosts file

Hot Fix: Command pre-kubeadm - Use super-admin.conf during kubeadm init

Create kubeadm init configuration file

Initialize the control plane with custom configuration file kubeadm-init.yaml

Hot Fix: Command post-kubeadm - Revert the static pod back to admin.conf after successful kubeadm init

Save the initialized information into text file

Source out KUBECONFIG for root user

Examine master node connectivity

Display the load balancer configuration

Watch things interact with the API server with auto-refresh the connections

Create regular user

Create user for k8suser

Set password for k8suser

Grant sudo privileges

Insert above line into the file

Add user k8suser to the docker group

Check which groups a user belongs to

Switch to user k8suser to manage Kubernetes cluster

Implement Calico Network (CNI)

Create directory to store the manifest file

Download and Apply Calico CNI

Last updated

Was this helpful?