Here, we will are going to learn how to setup a Multi Node Kubernetes Cluster on mac with example and details.
To setup a multi node Kubernetes cluster on a Mac, you can use kind (Kubernetes IN Docker). kind is a tool for running local Kubernetes clusters using Docker container “nodes.” This guide assumes that you have Docker Desktop installed and running on your Mac.
- A Mac with Apple silicon (M1 chip) or Intel-based Mac (2011 model or newer).
- macOS 10.14 Mojave or later.
- Install Docker Desktop
Step 1: Install kind
Install kind using Homebrew by running the following command in your terminal:
brew install kind
Step 2: Create a kind configuration file:
Create a configuration file to define your multi-node cluster. This configuration file allows you to customize the cluster’s settings, such as the number of control-plane and worker nodes.
Create a file named
kind-config.yaml with the following content (Recommended – Create file and Run all given below commands at $HOME path)
kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - role: worker - role: worker
This configuration file creates a cluster with one control-plane node and two worker nodes. You can adjust the number of nodes as needed.
Step 3: Create the Kubernetes cluster
Now, create the Kubernetes cluster using the
kind create cluster command with the
kind create cluster --name my-cluster --config kind-config.yaml
This command creates a Kubernetes cluster named “my-cluster” with the specified configuration.
Step 4: Configure kubectl to interact with the cluster
kind automatically creates a kubeconfig file for the cluster, which can be found in
kubectl with the new cluster, set the
KUBECONFIG environment variable:
Alternatively, you can set the context with
kubectl config use-context kind-my-cluster
Step 5: Verify the cluster
kubectl to verify that the multi-node Kubernetes cluster is running:
kubectl get nodes
You should see one control-plane node and two worker nodes with the “Ready” status.
Step 6: Delete the cluster
If you are done then you can also delete the cluster.
kind delete cluster --name my-cluster
To learn more about golang, Please refer given below link.