After configuring basic K3s (Kubernetes on Docker) setup on my lab with default commands. I found it created single node k8s cluster. I wanted a multi node Kubernetes cluster to be setup with multiple masters and workers.
As my K3d server and cluster is already installed and configured using with my earlier article Install k3d Kubernetes on docker on ubuntu linux server, I wanted to delete/destroy existing cluster created on it. To proceed fist list the existing clusters with k3d cluster list command to know what need to be destroyed. Next use command k3d cluster delete <clustername> to delete/destory it.
root@kubernetes01:~# k3d cluster list NAME SERVERS AGENTS LOADBALANCER mycluster 1/1 0/0 true root@kubernetes01:~# root@kubernetes01:~# k3d cluster delete mycluster INFO[0000] Deleting cluster 'mycluster' INFO[0001] Deleting cluster network 'k3d-mycluster' INFO[0002] Deleting 1 attached volumes... INFO[0002] Removing cluster details from default kubeconfig... INFO[0002] Removing standalone kubeconfig file (if there is one)... INFO[0002] Successfully deleted cluster mycluster! root@kubernetes01:~#
Next while creating new cluster I defined few syntax parameters to command k3d cluster create mycluster --servers 1 --agents 2.
Here is break down of the syntax
--agents 1: Creates 1 agent node (which will also serve as the server node ).
--workers 2: Creates 2 worker nodes.
Above command will create a cluster with the following nodes:
1 server node (also acting as an agent)
2 worker nodes
Once cluster is configured check and verify the list of nodes are created and configured successfully with command kubectl get node.
Note: By default, k3d creates a single-node cluster. Using the --agents and --workers flags allows you to customize the cluster's node topology.
root@kubernetes01:~# root@kubernetes01:~# k3d cluster create mycluster --servers 1 --agents 2 INFO[0000] Prep: Network INFO[0000] Created network 'k3d-mycluster' INFO[0000] Created image volume k3d-mycluster-images INFO[0000] Starting new tools node... INFO[0000] Starting node 'k3d-mycluster-tools' INFO[0001] Creating node 'k3d-mycluster-server-0' INFO[0001] Creating node 'k3d-mycluster-agent-0' INFO[0001] Creating node 'k3d-mycluster-agent-1' INFO[0001] Creating LoadBalancer 'k3d-mycluster-serverlb' INFO[0001] Using the k3d-tools node to gather environment information INFO[0001] HostIP: using network gateway 172.18.0.1 address INFO[0001] Starting cluster 'mycluster' INFO[0001] Starting servers... INFO[0001] Starting node 'k3d-mycluster-server-0' INFO[0006] Starting agents... INFO[0006] Starting node 'k3d-mycluster-agent-0' INFO[0006] Starting node 'k3d-mycluster-agent-1' INFO[0013] Starting helpers... INFO[0013] Starting node 'k3d-mycluster-serverlb' INFO[0020] Injecting records for hostAliases (incl. host.k3d.internal) and for 4 network members into CoreDNS configmap... INFO[0022] Cluster 'mycluster' created successfully! INFO[0022] You can now use it like this: kubectl cluster-info root@kubernetes01:~# root@kubernetes01:~# kubectl get node NAME STATUS ROLES AGE VERSION k3d-mycluster-agent-0 Ready <none> 32s v1.30.3+k3s1 k3d-mycluster-agent-1 Ready <none> 31s v1.30.3+k3s1 k3d-mycluster-server-0 Ready control-plane,master 37s v1.30.3+k3s1 root@kubernetes01:~#
Useful Articles
How to install Ansible AWX on Ubuntu using Kubernetes K8S
Powershell Using vRealize Log Insight Rest API
Install kubectl.exe on windows using PowerShell
Using terraform to clone a virtual machine on VMware vSphere infrastructure
Terraform module clone VMware vSphere Linux and Windows virtual machine
Terraform VMware vSphere Virtual Machine customization clone failed on Windows
Terraform VMware vSphere Virtual Machine cloning Operating system not found
How to Install Minikube on Ubuntu - Step by Step
MINIKUBE Unable to start VM - This computer doesn't have VT-X AMD-v enabled
Install and Setup your own Kubernetes Cluster with K3s
Rancher k3s.yaml permission denied when using kubectl - Kubernetes
Configure Nginx Load Balancer for the Kubernetes API Server - Part 1
Install and configure Kubernetes cluster master nodes using kubeadm - Part 2
Install and configure Kubernetes cluster worker nodes using kubeadm - Part 3
Kubernetes kubeadm join couldn't validate the identity of the API server connection refused
Kubernetes kubeadm join could not find a jws signature in the cluster-info ConfigMap for token ID
Setup and deploy Ingress controller for Kubernetes on Bare Metal servers
Setup HAProxy for Ingress Controller Kubernetes Cluster