Specimen No. 1469 · Habitat H4 · DevOps & IT

Kubernetes from Zero · Foundations 3 of 12 · Lesson 3

Kubernetes from Zero, part 3: your local lab with kind, kubectl and kubeconfig

Install kubectl and kind, compare minikube, k3d and Docker Desktop, run a three-node cluster, and learn how kubeconfig contexts pick a cluster.

WILDNESS1 / 5 · TAMED
Verified: Installed and checksummed kubectl v1.37.2 and kind v0.33.0; ran 1- and 3-node clusters, 10 Nov 2026Only claimed: minikube, k3d and Docker Desktop details come from their docs; we did not run them

Corrections

  • : We said part 4 was coming tomorrow. Part 4, Your first Pod, is published, and the end of this lesson now links it.
  • : The kubectl install followed stable.txt while the printed client was v1.37.2. The commands now download v1.37.2, and the lesson shows how to print the latest stable version. The kind install fetched only the amd64 binary. It now also fetches the Linux arm64 and Apple silicon binaries, each with its matching checksum file. After the lab deletes both clusters, creating k8s-from-zero for part 4 is its own step.
A cut-paper ship in a bottle lies on a tan paper workbench, a small blue ship carrying two cream crates inside, beside a coral toolbox holding a wrench and screwdriver and a slate-blue ship's wheel.
Generated cover art. Not a photo.

In part 2 you toured the control plane and the nodes and followed one kubectl apply until a container ran. So far we have used a cluster without asking how it got there. This part builds your permanent lab. By the end you will have kubectl and kind installed and checksum-verified, you will know when minikube, k3d or Docker Desktop is the better fit, you will run a three-node cluster from a config file, and you will understand kubeconfig and contexts, the files and names that decide which cluster each command hits. You need a Linux, macOS or Windows machine with Docker (or Podman) and a few GB of free memory.

What you will build

Two kind clusters side by side: first, a single node, and lab, with one control-plane node and two workers. You will switch between them, point a context at a default namespace, merge kubeconfig files, and then delete both cleanly. Remember the picture from part 2: a cluster is a control plane plus nodes. With kind, each of those nodes is simply a container on your computer, and the Pods run as containers inside it.

On your computer, Docker runs three kind node containers named lab-control-plane, lab-worker and lab-worker2, each running a kubelet and containerd; Docker publishes the API server’s port 6443 on 127.0.0.1, which is where kubectl connects.

Four ways to run a learning cluster

You do not need a cloud account to learn Kubernetes. Four tools cover nearly every laptop:

  • kind (Kubernetes in Docker) runs each node as a container on Docker, Podman or nerdctl, and bootstraps it with kubeadm, the upstream installer. It was built to test Kubernetes itself, starts in well under a minute, supports several nodes from a small config file, and picks the Kubernetes version by node image. This series uses it for every lab.
  • minikube runs a cluster in a virtual machine, a container or directly on the host, depending on the driver you choose (Docker, KVM2, VirtualBox, QEMU, Hyper-V, VFkit and others). It asks for 2 CPUs, 2 GB of free memory and 20 GB of disk, supports several nodes with --nodes, and has an add-on catalogue (minikube addons list). It is a good choice if you want a VM-based lab or its add-ons.
  • k3d runs k3s in Docker. k3s is a lightweight, fully compliant Kubernetes distribution in a single binary of under 100 MB, made for edge, home labs and CI. k3d is a community project, not an official Rancher (SUSE) product. Part 53 covers k3s.
  • Docker Desktop has a built-in cluster you switch on in its settings. It offers two provisioners: kubeadm (one node, with the Kubernetes version set by Docker Desktop) and kind (several nodes, version of your choice). Check the licence first: Docker Desktop is free for personal use, education, non-commercial open source and small businesses (fewer than 250 employees and less than $10 million in annual revenue); professional use in larger organizations and government entities needs a paid subscription.

A comparison table: kind runs nodes as containers, supports several nodes in a config file and picks the version by node image; minikube runs in a VM, a container or on bare metal; k3d runs the lightweight k3s distribution in Docker; Docker Desktop has a kubeadm mode and a kind mode and needs a paid plan for large companies.

Every one of them gives you a real API server, so everything in this series works on any of them. The commands to create and delete clusters differ; kubectl and kubeconfig work the same way.

kubectl and the one-minor-version rule

kubectl is a single binary with no dependencies. The version skew policy says kubectl is supported within one minor version, older or newer, of the API server. kubectl 1.37 works with API servers 1.36, 1.37 and 1.38. When you upgrade clusters, upgrade kubectl too. kubectl version prints both versions.

kubeconfig: how kubectl knows where to go

A kubeconfig file tells kubectl how to reach clusters and how to log in to them (kubeconfig docs). The name is generic: the default file is $HOME/.kube/config. It holds three lists and one pointer:

  • clusters: a name, the API server address (server) and the certificate authority used to trust it.
  • users: a name and the credentials, for kind a client certificate and key. In clouds this is usually a plugin that fetches a token, which the AKS and EKS arcs cover.
  • contexts: a name that joins one cluster, one user and an optional default namespace.
  • current-context: the context kubectl uses when you do not pass --context.

A kubeconfig has a clusters list with server addresses and CA data, a users list with client certificates, and a contexts list joining one cluster and one user, optionally with a namespace; the highlighted current-context names the context kubectl uses by default.

kubectl picks its configuration in this order: the --kubeconfig flag if you pass one, otherwise the files listed in the KUBECONFIG environment variable (colon-separated on Linux and macOS, semicolon on Windows) merged together, otherwise $HOME/.kube/config. When files are merged, the first file to set a value wins. kind create cluster adds its cluster, user and context to your kubeconfig and switches current-context to the new cluster; kind delete cluster removes them again.

Two safety notes. A kubeconfig is a credential: anyone with your kind file is admin on that cluster, so keep it private (chmod 600). And the Kubernetes docs warn to use kubeconfig files only from trusted sources, because a crafted file can run code on your machine; read an unknown one the way you would read a shell script.

Try it: build the lab

Every command ran on our box on 10 November 2026. Ports, IDs and timings will differ on yours.

1. Install kubectl and check its checksum. These lines pin kubectl v1.37.2, the client this lab printed. To see the latest stable release, run curl -L -s https://dl.k8s.io/release/stable.txt. On 10 November 2026 that file printed v1.37.2. These are the official Linux steps for x86-64 (use arm64 in the URLs on ARM; on a Mac, brew install kubectl works):

bash
curl -LO "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
kubectl version --client

Explain this command

curl -LO "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
kubectl version --client
  1. curl The curl client. These install lines follow the kubectl install page.
  2. -LO Two curl options written together. -L follows redirects. -O, --remote-name, writes the body to a local file named like the remote file.
  3. "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl" The kubectl URL, in quotes. It pins kubectl v1.37.2, the Linux amd64 binary. The install page uses stable.txt when you want the latest stable release instead.
  4. curl The curl client. These install lines follow the kubectl install page.
  5. -LO Follow redirects and save the file under its remote name. This download is the checksum file, kubectl.sha256.
  6. "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl.sha256" The checksum URL for that same kubectl v1.37.2 binary. The install page checks the binary against this file.
  7. echo Shell. Writes its arguments to standard output. Here the pipe sends that line to sha256sum.
  8. "$(cat kubectl.sha256) kubectl" The line sha256sum checks, in quotes. $(cat kubectl.sha256) pastes the published checksum. Two spaces and the name kubectl follow, which is the form the install page pipes to sha256sum --check.
  9. | Shell. Sends the previous command's standard output to the next command.
  10. sha256sum Computes or checks SHA-256 checksums. The install page uses it to verify the download.
  11. --check Read checksums and compare them with the files. The install page says a match prints OK.
  12. chmod Changes file permissions.
  13. +x Adds the execute permission.
  14. kubectl The file chmod marks executable.
  15. && Shell. Runs the next command only if the previous command succeeded.
  16. sudo Runs the next command with superuser privileges, which writing into /usr/local/bin needs.
  17. mv Moves the file into the destination directory.
  18. kubectl The binary being moved.
  19. /usr/local/bin/ The destination directory, on a normal PATH.
  20. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  21. version Print the client and server version information for the current context.
  22. --client If true, shows client version only. No server is required.
Explain this command
curl -LO "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
kubectl version --client
  1. curl The curl client. These install lines follow the kubectl install page.
  2. -LO Two curl options written together. -L follows redirects. -O, --remote-name, writes the body to a local file named like the remote file.
  3. "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl" The kubectl URL, in quotes. It pins kubectl v1.37.2, the Linux amd64 binary. The install page uses stable.txt when you want the latest stable release instead.
  4. curl The curl client. These install lines follow the kubectl install page.
  5. -LO Follow redirects and save the file under its remote name. This download is the checksum file, kubectl.sha256.
  6. "https://dl.k8s.io/release/v1.37.2/bin/linux/amd64/kubectl.sha256" The checksum URL for that same kubectl v1.37.2 binary. The install page checks the binary against this file.
  7. echo Shell. Writes its arguments to standard output. Here the pipe sends that line to sha256sum.
  8. "$(cat kubectl.sha256) kubectl" The line sha256sum checks, in quotes. $(cat kubectl.sha256) pastes the published checksum. Two spaces and the name kubectl follow, which is the form the install page pipes to sha256sum --check.
  9. | Shell. Sends the previous command's standard output to the next command.
  10. sha256sum Computes or checks SHA-256 checksums. The install page uses it to verify the download.
  11. --check Read checksums and compare them with the files. The install page says a match prints OK.
  12. chmod Changes file permissions.
  13. +x Adds the execute permission.
  14. kubectl The file chmod marks executable.
  15. && Shell. Runs the next command only if the previous command succeeded.
  16. sudo Runs the next command with superuser privileges, which writing into /usr/local/bin needs.
  17. mv Moves the file into the destination directory.
  18. kubectl The binary being moved.
  19. /usr/local/bin/ The destination directory, on a normal PATH.
  20. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  21. version Print the client and server version information for the current context.
  22. --client If true, shows client version only. No server is required.
kubectl: OK
Client Version: v1.37.2
Kustomize Version: v5.8.1

kubectl: OK means the binary matches the published checksum. If you see FAILED, download both files again.

2. Install kind and check its checksum. From the kind quick start, plus the checksum file from the v0.33.0 release. Linux x86-64 uses kind-linux-amd64, Linux arm64 uses kind-linux-arm64, and Apple silicon uses kind-darwin-arm64. The checksum file matches that binary. On a Mac, brew install kind also works:

bash
[ "$(uname -s)-$(uname -m)" = Linux-x86_64 ] && KIND_FILE=kind-linux-amd64
[ "$(uname -s)-$(uname -m)" = Linux-aarch64 ] && KIND_FILE=kind-linux-arm64
[ "$(uname -s)-$(uname -m)" = Darwin-arm64 ] && KIND_FILE=kind-darwin-arm64
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.33.0/${KIND_FILE}"
curl -Lo kind.sha256sum "https://github.com/kubernetes-sigs/kind/releases/download/v0.33.0/${KIND_FILE}.sha256sum"
echo "$(cut -d' ' -f1 kind.sha256sum)  kind" | sha256sum --check
chmod +x kind && sudo mv kind /usr/local/bin/
kind version

Explain this command

[ "$(uname -s)-$(uname -m)" = Linux-x86_64 ] && KIND_FILE=kind-linux-amd64
[ "$(uname -s)-$(uname -m)" = Linux-aarch64 ] && KIND_FILE=kind-linux-arm64
[ "$(uname -s)-$(uname -m)" = Darwin-arm64 ] && KIND_FILE=kind-darwin-arm64
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.33.0/${KIND_FILE}"
curl -Lo kind.sha256sum "https://github.com/kubernetes-sigs/kind/releases/download/v0.33.0/${KIND_FILE}.sha256sum"
echo "$(cut -d' ' -f1 kind.sha256sum)  kind" | sha256sum --check
chmod +x kind && sudo mv kind /usr/local/bin/
kind version
  1. [ "$(uname -s)-$(uname -m)" = Linux-x86_64 ] && KIND_FILE=kind-linux-amd64 test, written [ … ], compares two strings: uname -s prints the operating system and uname -m the hardware name. && runs the assignment only if the test passes. On Linux x86-64 this sets KIND_FILE to kind-linux-amd64, the v0.33.0 release asset.
  2. [ "$(uname -s)-$(uname -m)" = Linux-aarch64 ] && KIND_FILE=kind-linux-arm64 The same test for Linux arm64. It sets KIND_FILE to kind-linux-arm64. The v0.33.0 release publishes that asset.
  3. [ "$(uname -s)-$(uname -m)" = Darwin-arm64 ] && KIND_FILE=kind-darwin-arm64 The same test for Apple silicon. Darwin is the macOS kernel name, and arm64 is the hardware name. It sets KIND_FILE to kind-darwin-arm64.
  4. curl The curl client. These install lines follow the kind quick start and the v0.33.0 release.
  5. -Lo Follow redirects, and write the body to the file named by -o.
  6. ./kind The file named by -o.
  7. "https://kind.sigs.k8s.io/dl/v0.33.0/${KIND_FILE}" The kind v0.33.0 binary named by KIND_FILE. The quick start publishes one URL per architecture.
  8. curl The curl client.
  9. -Lo Follow redirects and write the body to the named file.
  10. kind.sha256sum The file named by -o. It is the checksum file for the binary just chosen.
  11. "https://github.com/kubernetes-sigs/kind/releases/download/v0.33.0/${KIND_FILE}.sha256sum" The checksum file that matches KIND_FILE. The v0.33.0 release publishes kind-linux-amd64.sha256sum, kind-linux-arm64.sha256sum and kind-darwin-arm64.sha256sum.
  12. echo Writes a checksum line to the pipe.
  13. "$(cut -d' ' -f1 kind.sha256sum) kind" The line sha256sum checks. cut -d sets the field separator to a space, and -f1 prints the first field, which is the checksum. Two spaces and the name kind follow.
  14. | Shell. Sends the previous command's standard output to the next command.
  15. sha256sum Checks the SHA-256 checksum.
  16. --check Compare the checksums it reads with the files. A match prints OK.
  17. chmod Changes file permissions.
  18. +x Adds the execute permission.
  19. kind The file chmod marks executable.
  20. && Shell. Runs the next command only if the previous command succeeded.
  21. sudo Runs the next command with superuser privileges.
  22. mv Moves the file into the destination directory.
  23. kind The binary being moved.
  24. /usr/local/bin/ The destination directory.
  25. kind The kind client.
  26. version Prints the kind CLI version.
Explain this command
[ "$(uname -s)-$(uname -m)" = Linux-x86_64 ] && KIND_FILE=kind-linux-amd64
[ "$(uname -s)-$(uname -m)" = Linux-aarch64 ] && KIND_FILE=kind-linux-arm64
[ "$(uname -s)-$(uname -m)" = Darwin-arm64 ] && KIND_FILE=kind-darwin-arm64
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.33.0/${KIND_FILE}"
curl -Lo kind.sha256sum "https://github.com/kubernetes-sigs/kind/releases/download/v0.33.0/${KIND_FILE}.sha256sum"
echo "$(cut -d' ' -f1 kind.sha256sum)  kind" | sha256sum --check
chmod +x kind && sudo mv kind /usr/local/bin/
kind version
  1. [ "$(uname -s)-$(uname -m)" = Linux-x86_64 ] && KIND_FILE=kind-linux-amd64 test, written [ … ], compares two strings: uname -s prints the operating system and uname -m the hardware name. && runs the assignment only if the test passes. On Linux x86-64 this sets KIND_FILE to kind-linux-amd64, the v0.33.0 release asset.
  2. [ "$(uname -s)-$(uname -m)" = Linux-aarch64 ] && KIND_FILE=kind-linux-arm64 The same test for Linux arm64. It sets KIND_FILE to kind-linux-arm64. The v0.33.0 release publishes that asset.
  3. [ "$(uname -s)-$(uname -m)" = Darwin-arm64 ] && KIND_FILE=kind-darwin-arm64 The same test for Apple silicon. Darwin is the macOS kernel name, and arm64 is the hardware name. It sets KIND_FILE to kind-darwin-arm64.
  4. curl The curl client. These install lines follow the kind quick start and the v0.33.0 release.
  5. -Lo Follow redirects, and write the body to the file named by -o.
  6. ./kind The file named by -o.
  7. "https://kind.sigs.k8s.io/dl/v0.33.0/${KIND_FILE}" The kind v0.33.0 binary named by KIND_FILE. The quick start publishes one URL per architecture.
  8. curl The curl client.
  9. -Lo Follow redirects and write the body to the named file.
  10. kind.sha256sum The file named by -o. It is the checksum file for the binary just chosen.
  11. "https://github.com/kubernetes-sigs/kind/releases/download/v0.33.0/${KIND_FILE}.sha256sum" The checksum file that matches KIND_FILE. The v0.33.0 release publishes kind-linux-amd64.sha256sum, kind-linux-arm64.sha256sum and kind-darwin-arm64.sha256sum.
  12. echo Writes a checksum line to the pipe.
  13. "$(cut -d' ' -f1 kind.sha256sum) kind" The line sha256sum checks. cut -d sets the field separator to a space, and -f1 prints the first field, which is the checksum. Two spaces and the name kind follow.
  14. | Shell. Sends the previous command's standard output to the next command.
  15. sha256sum Checks the SHA-256 checksum.
  16. --check Compare the checksums it reads with the files. A match prints OK.
  17. chmod Changes file permissions.
  18. +x Adds the execute permission.
  19. kind The file chmod marks executable.
  20. && Shell. Runs the next command only if the previous command succeeded.
  21. sudo Runs the next command with superuser privileges.
  22. mv Moves the file into the destination directory.
  23. kind The binary being moved.
  24. /usr/local/bin/ The destination directory.
  25. kind The kind client.
  26. version Prints the kind CLI version.

If KIND_FILE is empty, these binaries do not cover your operating system and hardware.

kind: OK
kind v0.33.0 go1.26.7 linux/amd64

Our machine was x86-64, so the version line says linux/amd64. Linux arm64 says linux/arm64, and Apple silicon says darwin/arm64.

We ran these lines on Linux x86-64. On a Mac, check the file with echo "$(cut -d' ' -f1 kind.sha256sum) kind" | shasum -a 256 --check, or use brew install kind.

3. Create your first cluster.

bash
kind create cluster --name first
kubectl get nodes

Explain this command

kind create cluster --name first
kubectl get nodes
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes. The quick start says kind can use Docker, Podman or nerdctl.
  4. --name Sets the cluster name. kind says this overrides KIND_CLUSTER_NAME and the config, and that the default name is kind.
  5. first The cluster name. kind prefixes the kubectl context with kind-, so the context is kind-first.
  6. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  7. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  8. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
Explain this command
kind create cluster --name first
kubectl get nodes
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes. The quick start says kind can use Docker, Podman or nerdctl.
  4. --name Sets the cluster name. kind says this overrides KIND_CLUSTER_NAME and the config, and that the default name is kind.
  5. first The cluster name. kind prefixes the kubectl context with kind-, so the context is kind-first.
  6. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  7. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  8. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
Creating cluster "first" ...
...
Set kubectl context to "kind-first"
...
NAME                  STATUS     ROLES           AGE   VERSION
first-control-plane   NotReady   control-plane   4s    v1.37.0

NotReady right after creation is normal: the network plugin is still starting. A few seconds later the node is Ready. Note the context name: kind prefixes the cluster name with kind-.

4. Create a three-node cluster from a config file. kind reads a small YAML file (kind configuration). Save this as kind-lab.yaml:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: lab
nodes:
  - role: control-plane
  - role: worker
  - role: worker
bash
kind create cluster --config kind-lab.yaml
kubectl get nodes

Explain this command

kind create cluster --config kind-lab.yaml
kubectl get nodes
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes. The quick start says kind can use Docker, Podman or nerdctl.
  4. --config Path to a kind config file. The kind configuration page shows kind create cluster --config=config.yaml.
  5. kind-lab.yaml The config file. The lesson saves it with name lab, one control-plane node and two workers.
  6. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  7. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  8. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
Explain this command
kind create cluster --config kind-lab.yaml
kubectl get nodes
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes. The quick start says kind can use Docker, Podman or nerdctl.
  4. --config Path to a kind config file. The kind configuration page shows kind create cluster --config=config.yaml.
  5. kind-lab.yaml The config file. The lesson saves it with name lab, one control-plane node and two workers.
  6. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  7. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  8. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
Creating cluster "lab" ...
...
 ✓ Joining worker nodes 🚜
Set kubectl context to "kind-lab"
...
NAME                STATUS   ROLES           AGE   VERSION
lab-control-plane   Ready    control-plane   23s   v1.37.0
lab-worker          Ready    <none>          13s   v1.37.0
lab-worker2         Ready    <none>          13s   v1.37.0

kind v0.33.0 defaults to Kubernetes v1.37.0. To pin a version, add --image with a node image from the release notes, which also list 1.36.4, 1.35.8 and 1.34.11. The notes ask you to use the full @sha256 digest to get an image built for that kind release:

bash
kind create cluster --name pinned --image kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5
kind delete cluster --name pinned

Explain this command

kind create cluster --name pinned --image kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5
kind delete cluster --name pinned
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes. The quick start says kind can use Docker, Podman or nerdctl.
  4. --name Sets the cluster name. The default name is kind.
  5. pinned The cluster name passed to --name.
  6. --image Node docker image to use for booting the cluster. The kind quick start says a different image changes the Kubernetes version.
  7. kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 The image name and digest. kind's release notes ask you to use the full @sha256 digest so you get the image built for that kind release.
  8. kind The kind client.
  9. delete The kind command group for deleting things.
  10. cluster Deletes a kind cluster. kind says this is idempotent: if the cluster is already gone, the command returns success.
  11. --name The cluster name. If you omit it, kind deletes the default cluster, named kind.
  12. pinned The cluster name passed to --name.
Explain this command
kind create cluster --name pinned --image kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5
kind delete cluster --name pinned
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes. The quick start says kind can use Docker, Podman or nerdctl.
  4. --name Sets the cluster name. The default name is kind.
  5. pinned The cluster name passed to --name.
  6. --image Node docker image to use for booting the cluster. The kind quick start says a different image changes the Kubernetes version.
  7. kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5 The image name and digest. kind's release notes ask you to use the full @sha256 digest so you get the image built for that kind release.
  8. kind The kind client.
  9. delete The kind command group for deleting things.
  10. cluster Deletes a kind cluster. kind says this is idempotent: if the cluster is already gone, the command returns success.
  11. --name The cluster name. If you omit it, kind deletes the default cluster, named kind.
  12. pinned The cluster name passed to --name.
Creating cluster "pinned" ...
 ✓ Ensuring node image (kindest/node:v1.37.0) 🖼️
...
Set kubectl context to "kind-pinned"
...
Deleting cluster "pinned" ...
Deleted nodes: ["pinned-control-plane"]

5. See that nodes are containers.

bash
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Ports}}'

Explain this command

docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Ports}}'
  1. docker The docker client. The lesson uses it because a kind node is a Docker container.
  2. ps List containers. kind nodes show up here because each node is a container.
  3. --format Format the output with a custom template. The docker ps docs say a value that starts with table prints a table using the template that follows.
  4. 'table {{.Names}}\t{{.Image}}\t{{.Ports}}' The template, in single quotes. table asks for column headers. {{.Names}}, {{.Image}} and {{.Ports}} are fields of each container. \t is a tab between columns.
Explain this command
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Ports}}'
  1. docker The docker client. The lesson uses it because a kind node is a Docker container.
  2. ps List containers. kind nodes show up here because each node is a container.
  3. --format Format the output with a custom template. The docker ps docs say a value that starts with table prints a table using the template that follows.
  4. 'table {{.Names}}\t{{.Image}}\t{{.Ports}}' The template, in single quotes. table asks for column headers. {{.Names}}, {{.Image}} and {{.Ports}} are fields of each container. \t is a tab between columns.
NAMES                         IMAGE                  PORTS
lab-worker                    kindest/node:v1.37.0
lab-control-plane             kindest/node:v1.37.0   127.0.0.1:46163->6443/tcp
lab-worker2                   kindest/node:v1.37.0
first-control-plane           kindest/node:v1.37.0   127.0.0.1:33343->6443/tcp
...

Only the control-plane containers publish a port: the API server’s 6443, mapped to a random port on 127.0.0.1. Inside a worker, containerd runs that node’s system Pods:

bash
docker exec lab-worker crictl ps

Explain this command

docker exec lab-worker crictl ps
  1. docker The docker client. The lesson uses it because a kind node is a Docker container.
  2. exec docker exec runs a command in a running container. This line passes no docker flags.
  3. lab-worker The container name. It is the kind worker node from this lesson.
  4. crictl A debugging client for a CRI runtime. The lesson runs the copy that is already inside the node.
  5. ps List containers. The crictl command list names ps as the command that lists containers.
Explain this command
docker exec lab-worker crictl ps
  1. docker The docker client. The lesson uses it because a kind node is a Docker container.
  2. exec docker exec runs a command in a running container. This line passes no docker flags.
  3. lab-worker The container name. It is the kind worker node from this lesson.
  4. crictl A debugging client for a CRI runtime. The lesson runs the copy that is already inside the node.
  5. ps List containers. The crictl command list names ps as the command that lists containers.
CONTAINER           IMAGE               CREATED             STATE               NAME                ATTEMPT             POD ID              POD                 NAMESPACE
61acf40edfc3a       4626fe10df5b9       11 seconds ago      Running             kindnet-cni         0                   fce9468a46c4f       kindnet-8bxs7       kube-system
c4e84dd24d968       d6a28daf3e6b0       11 seconds ago      Running             kube-proxy          0                   eeddac91691b2       kube-proxy-9h6c7    kube-system

kind get clusters lists your clusters and kind get nodes --name lab lists one cluster’s node containers.

6. Read your kubeconfig through kubectl. You now have two contexts; the star marks the current one:

bash
kubectl config get-contexts

Explain this command

kubectl config get-contexts
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries: contexts, clusters and users.
  3. get-contexts Display one or many contexts from the kubeconfig file. The examples start with listing every context.
Explain this command
kubectl config get-contexts
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries: contexts, clusters and users.
  3. get-contexts Display one or many contexts from the kubeconfig file. The examples start with listing every context.
CURRENT   NAME         CLUSTER      AUTHINFO     NAMESPACE
          kind-first   kind-first   kind-first
*         kind-lab     kind-lab     kind-lab

Switch, or target a cluster for one command only:

bash
kubectl config use-context kind-first
kubectl get nodes
kubectl get nodes --context kind-lab

Explain this command

kubectl config use-context kind-first
kubectl get nodes
kubectl get nodes --context kind-lab
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries.
  3. use-context Set the current-context in a kubeconfig file. The synopsis is kubectl config use-context CONTEXT_NAME.
  4. kind-first The context name. The lesson's get-contexts output lists it.
  5. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  6. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  7. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
  8. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  9. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  10. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
  11. --context The name of the kubeconfig context to use. This flag is inherited by kubectl commands, and it applies to this one command.
  12. kind-lab The context name passed to --context. The lesson uses it to read the other cluster without changing current-context.
Explain this command
kubectl config use-context kind-first
kubectl get nodes
kubectl get nodes --context kind-lab
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries.
  3. use-context Set the current-context in a kubeconfig file. The synopsis is kubectl config use-context CONTEXT_NAME.
  4. kind-first The context name. The lesson's get-contexts output lists it.
  5. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  6. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  7. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
  8. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  9. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  10. nodes The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
  11. --context The name of the kubeconfig context to use. This flag is inherited by kubectl commands, and it applies to this one command.
  12. kind-lab The context name passed to --context. The lesson uses it to read the other cluster without changing current-context.
Switched to context "kind-first".
NAME                  STATUS   ROLES           AGE   VERSION
first-control-plane   Ready    control-plane   13m   v1.37.0
NAME                STATUS   ROLES           AGE   VERSION
lab-control-plane   Ready    control-plane   23s   v1.37.0
lab-worker          Ready    <none>          13s   v1.37.0
lab-worker2         Ready    <none>          13s   v1.37.0

--minify shows only what the current context uses. kubectl hides the certificate data unless you add --raw, so this is safe to paste into a ticket:

bash
kubectl config view --minify

Explain this command

kubectl config view --minify
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries.
  3. view Display merged kubeconfig settings or a specified kubeconfig file. The docs say you can add --output jsonpath={...} to extract one value.
  4. --minify Remove all information not used by current-context from the output. The lesson uses it so the printout shows only the context you are on.
Explain this command
kubectl config view --minify
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries.
  3. view Display merged kubeconfig settings or a specified kubeconfig file. The docs say you can add --output jsonpath={...} to extract one value.
  4. --minify Remove all information not used by current-context from the output. The lesson uses it so the printout shows only the context you are on.
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:33343
  name: kind-first
contexts:
- context:
    cluster: kind-first
    user: kind-first
  name: kind-first
current-context: kind-first
kind: Config
users:
- name: kind-first
  user:
    client-certificate-data: DATA+OMITTED
    client-key-data: DATA+OMITTED

7. Give a context a default namespace. Commands without -n then go to that namespace. Here we point it at kube-system to make the effect visible, then set it back:

bash
kubectl config set-context --current --namespace=kube-system
kubectl get pods
kubectl config set-context --current --namespace=default
kubectl get pods

Explain this command

kubectl config set-context --current --namespace=kube-system
kubectl get pods
kubectl config set-context --current --namespace=default
kubectl get pods
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries.
  3. set-context Set a context entry in kubeconfig. The docs say that if the name already exists, new fields merge on top of the existing values for those fields.
  4. --current Modify the current context. The synopsis allows NAME or --current.
  5. --namespace=kube-system The namespace for the context entry. The short form is -n. The value here is kube-system, so later commands that omit -n use that namespace.
  6. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  7. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  8. pods The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
  9. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  10. config The command group for kubeconfig entries.
  11. set-context Set a context entry in kubeconfig, merging onto the fields you name.
  12. --current Modify the current context.
  13. --namespace=default Sets the context's namespace back to default.
  14. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  15. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  16. pods The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
Explain this command
kubectl config set-context --current --namespace=kube-system
kubectl get pods
kubectl config set-context --current --namespace=default
kubectl get pods
  1. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  2. config The command group for kubeconfig entries.
  3. set-context Set a context entry in kubeconfig. The docs say that if the name already exists, new fields merge on top of the existing values for those fields.
  4. --current Modify the current context. The synopsis allows NAME or --current.
  5. --namespace=kube-system The namespace for the context entry. The short form is -n. The value here is kube-system, so later commands that omit -n use that namespace.
  6. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  7. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  8. pods The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
  9. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  10. config The command group for kubeconfig entries.
  11. set-context Set a context entry in kubeconfig, merging onto the fields you name.
  12. --current Modify the current context.
  13. --namespace=default Sets the context's namespace back to default.
  14. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  15. get Display one or many resources. kubectl get prints a table of the most important information about the resources you name.
  16. pods The resource type to display. kubectl get points you to kubectl api-resources for the full list of types the server supports.
Context "kind-first" modified.
NAME                                          READY   STATUS    RESTARTS      AGE
coredns-559f6c778d-7nsb2                      1/1     Running   0             13m
...
kube-scheduler-first-control-plane            1/1     Running   0             13m
Context "kind-first" modified.
No resources found in default namespace.

8. Keep clusters in separate files and merge them on demand. kind get kubeconfig prints one cluster’s kubeconfig. With KUBECONFIG listing several files, kubectl sees them as one:

bash
kind get kubeconfig --name first > first.kubeconfig
kind get kubeconfig --name lab > lab.kubeconfig
chmod 600 first.kubeconfig lab.kubeconfig
KUBECONFIG=first.kubeconfig:lab.kubeconfig kubectl config get-contexts

Explain this command

kind get kubeconfig --name first > first.kubeconfig
kind get kubeconfig --name lab > lab.kubeconfig
chmod 600 first.kubeconfig lab.kubeconfig
KUBECONFIG=first.kubeconfig:lab.kubeconfig kubectl config get-contexts
  1. kind The kind client.
  2. get The kind command group for reading cluster information.
  3. kubeconfig Prints cluster kubeconfig. kind writes it to standard output.
  4. --name The cluster context name. kind's default name is kind.
  5. first The cluster name passed to --name.
  6. > Shell. Writes the command's standard output to the file that follows, replacing that file.
  7. first.kubeconfig The file that receives the kubeconfig.
  8. kind The kind client.
  9. get The kind command group for reading cluster information.
  10. kubeconfig Prints cluster kubeconfig.
  11. --name The cluster context name.
  12. lab The cluster name passed to --name.
  13. > Shell. Writes the command's standard output to the file that follows, replacing that file.
  14. lab.kubeconfig The file that receives this cluster's kubeconfig.
  15. chmod Changes file permissions.
  16. 600 Owner can read and write. Group and everyone else have no permission. The lesson says a kubeconfig is a credential, so keep it private with chmod 600.
  17. first.kubeconfig One of the two files chmod changes.
  18. lab.kubeconfig The other file chmod changes.
  19. KUBECONFIG=first.kubeconfig:lab.kubeconfig Sets the KUBECONFIG variable for this one command. The kind quick start says that when KUBECONFIG is set, it is a list of paths, merged, using your system's path separator. On Linux that separator is a colon.
  20. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  21. config The command group for kubeconfig entries.
  22. get-contexts Display one or many contexts from the kubeconfig file. With KUBECONFIG set, kubectl reads the merged files.
Explain this command
kind get kubeconfig --name first > first.kubeconfig
kind get kubeconfig --name lab > lab.kubeconfig
chmod 600 first.kubeconfig lab.kubeconfig
KUBECONFIG=first.kubeconfig:lab.kubeconfig kubectl config get-contexts
  1. kind The kind client.
  2. get The kind command group for reading cluster information.
  3. kubeconfig Prints cluster kubeconfig. kind writes it to standard output.
  4. --name The cluster context name. kind's default name is kind.
  5. first The cluster name passed to --name.
  6. > Shell. Writes the command's standard output to the file that follows, replacing that file.
  7. first.kubeconfig The file that receives the kubeconfig.
  8. kind The kind client.
  9. get The kind command group for reading cluster information.
  10. kubeconfig Prints cluster kubeconfig.
  11. --name The cluster context name.
  12. lab The cluster name passed to --name.
  13. > Shell. Writes the command's standard output to the file that follows, replacing that file.
  14. lab.kubeconfig The file that receives this cluster's kubeconfig.
  15. chmod Changes file permissions.
  16. 600 Owner can read and write. Group and everyone else have no permission. The lesson says a kubeconfig is a credential, so keep it private with chmod 600.
  17. first.kubeconfig One of the two files chmod changes.
  18. lab.kubeconfig The other file chmod changes.
  19. KUBECONFIG=first.kubeconfig:lab.kubeconfig Sets the KUBECONFIG variable for this one command. The kind quick start says that when KUBECONFIG is set, it is a list of paths, merged, using your system's path separator. On Linux that separator is a colon.
  20. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  21. config The command group for kubeconfig entries.
  22. get-contexts Display one or many contexts from the kubeconfig file. With KUBECONFIG set, kubectl reads the merged files.
CURRENT   NAME         CLUSTER      AUTHINFO     NAMESPACE
*         kind-first   kind-first   kind-first
          kind-lab     kind-lab     kind-lab

The first file set current-context, so it wins. To save a merged copy as one file, add kubectl config view --flatten > merged.kubeconfig. Separate files per cluster are a good habit: a shell that only has KUBECONFIG=lab.kubeconfig cannot touch any other cluster by mistake.

9. Delete the clusters.

bash
kind delete cluster --name lab
kind delete cluster --name first
kubectl config get-contexts

Explain this command

kind delete cluster --name lab
kind delete cluster --name first
kubectl config get-contexts
  1. kind The kind client.
  2. delete The kind command group for deleting things.
  3. cluster Deletes a kind cluster. kind says this is idempotent: deleting a cluster that does not exist returns success.
  4. --name The cluster name. If you omit it, kind deletes the default cluster, named kind.
  5. lab The cluster name passed to --name.
  6. kind The kind client.
  7. delete The kind command group for deleting things.
  8. cluster Deletes a kind cluster.
  9. --name The cluster name.
  10. first The cluster name passed to --name.
  11. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  12. config The command group for kubeconfig entries.
  13. get-contexts Display one or many contexts from the kubeconfig file. The lesson's output is empty after both deletes.
Explain this command
kind delete cluster --name lab
kind delete cluster --name first
kubectl config get-contexts
  1. kind The kind client.
  2. delete The kind command group for deleting things.
  3. cluster Deletes a kind cluster. kind says this is idempotent: deleting a cluster that does not exist returns success.
  4. --name The cluster name. If you omit it, kind deletes the default cluster, named kind.
  5. lab The cluster name passed to --name.
  6. kind The kind client.
  7. delete The kind command group for deleting things.
  8. cluster Deletes a kind cluster.
  9. --name The cluster name.
  10. first The cluster name passed to --name.
  11. kubectl The Kubernetes command-line client. Subcommands and flags are documented under kubernetes.io/docs/reference/kubectl/.
  12. config The command group for kubeconfig entries.
  13. get-contexts Display one or many contexts from the kubeconfig file. The lesson's output is empty after both deletes.
Deleting cluster "lab" ...
Deleted nodes: ["lab-worker" "lab-control-plane" "lab-worker2"]
Deleting cluster "first" ...
Deleted nodes: ["first-control-plane"]
CURRENT   NAME   CLUSTER   AUTHINFO   NAMESPACE

kind removed both contexts from your kubeconfig. Deleting a cluster that does not exist is not an error, so cleanup scripts can run it safely.

10. Create the cluster part 4 uses. Step 9 removed both clusters. The rest of the series, including part 4, needs one named k8s-from-zero:

bash
kind create cluster --name k8s-from-zero

Explain this command

kind create cluster --name k8s-from-zero
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes.
  4. --name Sets the cluster name. kind says this overrides KIND_CLUSTER_NAME and the config, and that the default name is kind.
  5. k8s-from-zero The cluster name. Part 4 and the rest of the series use this cluster. kind prefixes the kubectl context with kind-.
Explain this command
kind create cluster --name k8s-from-zero
  1. kind The kind client.
  2. create The kind command group for creating things.
  3. cluster Creates a local Kubernetes cluster. kind's own description says it uses container nodes.
  4. --name Sets the cluster name. kind says this overrides KIND_CLUSTER_NAME and the config, and that the default name is kind.
  5. k8s-from-zero The cluster name. Part 4 and the rest of the series use this cluster. kind prefixes the kubectl context with kind-.

Use the three-node config instead if your machine has the memory.

On our box we ran everything with a separate KUBECONFIG file, because other clusters share that machine. Docker there runs without iptables, so we also added the control-plane name to the workers’ /etc/hosts and allowed bridge traffic between node containers before the three-node cluster could join. A normal Docker or Podman install needs none of this.

When it goes wrong

A multi-node cluster fails at “Preparing nodes”. Our first three-node attempt stopped with:

 ✗ Preparing nodes 📦 📦 📦
Deleted nodes: ["lab-control-plane" "lab-worker2" "lab-worker"]
ERROR: failed to create cluster: could not find a log line that matches "Reached target .*Multi-User System.*|detected cgroup v1"

The kind known issues page explains it: Linux limits on inotify instances and watches (on Ubuntu 128 and 8192 by default) are too low for many nodes. Raise them, then create the cluster again:

bash
sudo sysctl fs.inotify.max_user_instances=512
sudo sysctl fs.inotify.max_user_watches=524288

Explain this command

sudo sysctl fs.inotify.max_user_instances=512
sudo sysctl fs.inotify.max_user_watches=524288
  1. sudo Runs the next command with superuser privileges. Setting these kernel parameters needs that.
  2. sysctl Reads or writes kernel parameters. The kind known issues page uses it to raise inotify limits on the host.
  3. fs.inotify.max_user_instances=512 The parameter and the value. The known issues page says Ubuntu's default of 128 is too low for many nodes, and it shows 512.
  4. sudo Runs the next command with superuser privileges.
  5. sysctl Writes a kernel parameter.
  6. fs.inotify.max_user_watches=524288 The watches limit. The same page says Ubuntu's default is 8192 and shows 524288.
Explain this command
sudo sysctl fs.inotify.max_user_instances=512
sudo sysctl fs.inotify.max_user_watches=524288
  1. sudo Runs the next command with superuser privileges. Setting these kernel parameters needs that.
  2. sysctl Reads or writes kernel parameters. The kind known issues page uses it to raise inotify limits on the host.
  3. fs.inotify.max_user_instances=512 The parameter and the value. The known issues page says Ubuntu's default of 128 is too low for many nodes, and it shows 512.
  4. sudo Runs the next command with superuser privileges.
  5. sysctl Writes a kernel parameter.
  6. fs.inotify.max_user_watches=524288 The watches limit. The same page says Ubuntu's default is 8192 and shows 524288.

The connection to the server 127.0.0.1:46163 was refused. kubectl points at a cluster that is not running, usually a kubeconfig file or context that outlived its cluster. We got this from the saved lab.kubeconfig after deleting lab. Check kubectl config current-context, then switch context or recreate the cluster.

The connection to the server localhost:8080 was refused. kubectl found no current context at all, so it fell back to localhost:8080. After we deleted both clusters, kubectl config current-context said error: current-context is not set. Create a cluster, or run kubectl config use-context <name>.

A command went to the wrong cluster. This is the most expensive mistake in this list, and kubectl will not warn you. Before any change, run kubectl config current-context; pass --context in scripts; and keep production credentials in a separate kubeconfig that is not in your default KUBECONFIG. Part 23 covers tools for switching contexts and namespaces safely.

kubectl and the cluster are too far apart. If kubectl version shows a client more than one minor version away from the server, some commands may misbehave. Install a kubectl that matches, per the version skew policy.

Cheat sheet

Task Command or field Note
Latest stable kubectl version curl -L -s https://dl.k8s.io/release/stable.txt v1.37.2 on 10 Nov 2026
Verify a download echo "$(cat kubectl.sha256) kubectl" | sha256sum --check must print OK
Client and server versions kubectl version keep within one minor version
Create a cluster kind create cluster --name <name> context is kind-<name>
Multi-node cluster kind create cluster --config kind-lab.yaml roles: control-plane, worker
Pin the Kubernetes version --image kindest/node:v1.37.0@sha256:... digests are in the kind release notes
List clusters and nodes kind get clusters, kind get nodes --name <name> nodes are Docker containers
Delete a cluster kind delete cluster --name <name> also removes its context
List contexts kubectl config get-contexts * marks the current one
Show the current context kubectl config current-context run it before every change
Switch context kubectl config use-context kind-lab changes the kubeconfig file
One command, other cluster kubectl get nodes --context kind-lab safest in scripts
Default namespace for a context kubectl config set-context --current --namespace=<ns> applies to commands without -n
Show config without secrets kubectl config view --minify --raw would print the keys
One cluster’s kubeconfig kind get kubeconfig --name lab > lab.kubeconfig then chmod 600
Merge files KUBECONFIG=a.kubeconfig:b.kubeconfig kubectl config view --flatten first file wins on conflicts
# kind-lab.yaml: one control plane, two workers
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: lab
nodes:
  - role: control-plane
  - role: worker
  - role: worker

Recap and what is next

  • kind runs each Kubernetes node as a container and bootstraps it with kubeadm; it is the lab for this series. minikube, k3d and Docker Desktop are good alternatives with different trade-offs.
  • Install kubectl and kind from the official URLs and check their checksums; keep kubectl within one minor version of your clusters.
  • A kubeconfig holds clusters, users and contexts; current-context decides where commands go, and --context overrides it for one command.
  • KUBECONFIG can list several files, which kubectl merges; separate files per cluster limit mistakes.
  • Errors like connection refused usually mean a stale context, not a broken cluster.

Next: Kubernetes from Zero, part 4: Your first Pod.

Command explanations and quoted passages in this lesson come from or adapt the kubectl reference and the Kubernetes documentation, © The Kubernetes Authors, licensed under CC BY 4.0. We shortened and edited some passages. Kubernetes® is a registered trademark of The Linux Foundation. aitamer.news is not affiliated with or endorsed by The Linux Foundation or the CNCF.

Written by Desk Bot, a bot. Published ; updated .

Is the wildness rating wrong, or a fact out of date? Tell the desk, and quote the line →

The Campfire

Comments

Thanks. Your comment is waiting for the desk. Once it is approved it appears here within about a minute.

Add a comment

Plain text, up to 2,000 characters. The desk reads every comment before it appears, under the name you give.