Kubernetes cluster setup
Section 2, Lecture 2, from the Flux CD course by DevCloudLab.
What you’ll learn
- The trade-off between a managed Kubernetes service and a local cluster
- How to install Docker, kubectl, and kind on Ubuntu
- How to create a local kind cluster configured for HTTP/HTTPS ingress
- How to install and verify an NGINX ingress controller on that cluster
Two ways to get a cluster
| Approach | Examples | Best for |
|---|---|---|
| Managed Kubernetes service | Amazon EKS, Google GKE, Azure AKS, DigitalOcean Kubernetes | Production-like environments (the provider runs and upgrades the control plane) |
| Local cluster | kind (Kubernetes in Docker) | Fast, disposable clusters for development and for the labs in this course |
A managed service removes the operational burden of running Kubernetes yourself, but it costs money and takes longer to spin up. For the labs in this course, a local kind cluster is faster to create and destroy, and it’s free.
Installing Docker (Ubuntu)
kind runs each cluster node as a Docker container, so Docker has to be installed first. If Docker is already running on your machine, skip to Installing kubectl.
Install the prerequisite packages:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Add Docker’s GPG key to a keyring, then register the repository:
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Since this video was recorded:
apt-keyis deprecated on Ubuntu 22.04 and later, and Docker’s install guide no longer uses it or theadd-apt-repositoryshorthand. (add-apt-repositoryitself still ships.) The steps above follow the current guide: the key is saved to/etc/apt/keyrings/and referenced withsigned-byin the repository line; the video shows the olderapt-key/add-apt-repositoryform.
Install Docker itself:
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
Let your user run docker without sudo, then confirm it works:
sudo usermod -aG docker ${USER}
newgrp docker
docker version
On Windows or macOS, install Docker Desktop instead. It bundles the Docker engine and doesn’t need the steps above.
Installing kubectl
kubectl is the command-line client you use to talk to any Kubernetes cluster, local or remote.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client
The curl -L -s https://dl.k8s.io/release/stable.txt part resolves to the current stable Kubernetes release, so this always downloads a current kubectl build.
Installing kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.33.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version
Note: check the kind releases page for the current version number before running the first command.
v0.33.0was current at the time of writing, and kind ships new releases regularly.
Creating a cluster with ingress enabled
A plain kind create cluster gives you a working cluster with default settings. This course also needs ingress, which requires a config file so kind labels a node as ingress-ready and maps ports 80 and 443 from the container to your host.
Save this as cluster.yaml:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
Then create the cluster from it:
kind create cluster --config=cluster.yaml
kind automatically points kubectl at the new cluster, so you can use kubectl right away without any extra configuration.
Installing the ingress controller
With the cluster running, install the NGINX ingress controller build that kind publishes for its own clusters:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.15.1/deploy/static/provider/kind/deploy.yaml
Since this video was recorded: the video applies this file from the project’s
mainbranch. The URL above is pinned tocontroller-v1.15.1, so it always installs the same version. The ingress-nginx project was retired in March 2026 and its repository is now archived; v1.15.1 is its final release, and existing installs keep working.
Wait for the controller pod to become ready before deploying anything that depends on it:
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s
Once that command returns, the cluster can route Ingress objects to your services.
Using a managed cluster instead
If you’d rather skip local cluster management and use Amazon EKS, Google GKE, Azure AKS, or DigitalOcean Kubernetes, kind isn’t involved at all. Every provider has its own command to point kubectl at the cluster it created for you. For example, EKS uses aws eks update-kubeconfig. Follow your provider’s documentation for that one step; everything else in this course works the same way once kubectl is pointed at a working cluster.
Further reading
- Docker Engine install guide for Ubuntu
- Install kubectl on Linux
- kind Quick Start
- kind: Ingress
- Kubernetes Ingress concepts
Built by DevCloudLab
Hands-on cloud-native courses: Kubernetes, GitOps, CI/CD and the cloud.
Visit DevCloudLab.com →
