Cloud Native 9 min read

Setting Up a Local Kubernetes Cluster with Terraform, Kind, and ArgoCD for DevOps Training

This guide walks you through provisioning a local Kubernetes environment using Terraform and Kind, installing essential tools like kubectl and ArgoCD, and deploying a cloud‑native continuous‑delivery pipeline, providing a repeatable setup for DevOps hands‑on training.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Setting Up a Local Kubernetes Cluster with Terraform, Kind, and ArgoCD for DevOps Training

This article describes the preparation of the environment for the seventh session of a DevOps training camp, using Terraform and Kind to create a local Kubernetes cluster and deploying ArgoCD for subsequent tool delivery.

Prerequisites

Operating System: CentOS 8 Linux

Memory: 32 GB+

Tool Versions

Tool Name

Version

Description

Terraform

1.1.7

Uses the Kind provider to operate Kind

Kind

0.14.0

Kubernetes cluster creation tool

Docker‑CE

1.19+ (Docker 23.0.3)

Container runtime

kubectl

v1.24.0

Kubernetes CLI

Kubernetes

1.24.0

Container cloud platform

ArgoCD

2.6.7

Cloud‑native continuous‑delivery tool

NFS

Persistent storage for containers

Infrastructure code repository: https://jihulab.com/devopsvip/myiac

1. Install Terraform

Download and unzip Terraform 1.1.7:

$: unzip terraform_1.1.7_darwin_amd64.zip
Archive:  terraform_1.1.7_darwin_amd64.zip
  inflating: terraform
# ls
install.md                     terraform_1.1.7_darwin_amd64.zip
terraform
# mv terraform /usr/local/bin
# terraform version

2. Install Kind

wget  https://github.com/kubernetes-sigs/kind/releases/download/v0.14.0/kind-linux-amd64
mv kind-linux-amd64  /usr/bin/kind
chmod +x /usr/bin/kind

Official Kind documentation: https://kind.sigs.k8s.io/docs/user/configuration/#getting-started

3. Install kubectl

Refer to the official guide: https://kubernetes.io/docs/tasks/tools/#kubectl

4. Deploy the Kubernetes cluster

Pull required Docker images in advance:

kindest/node:v1.24.0

k8s.gcr.io/ingress-nginx/controller:v1.2.0

k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1

Clone the IaC repository:

git clone https://jihulab.com/devopsvip/myiac.git

Key files:

kind.tf – cluster configuration

ingress.yaml – Ingress installation manifest

Initialize and apply Terraform:

# install
cd k8s
terraform init
terraform apply --auto-approve
# uninstall
terraform destroy --auto-approve

Verify the cluster status:

kubectl get node
NAME                         STATUS   ROLES           AGE   VERSION
devopscluster-control-plane   Ready    control-plane   2m53s v1.24.0
devopscluster-worker         Ready
2m19s v1.24.0
test-cluster-worker2         Ready
2m20s v1.24.0

Check Ingress‑NGINX pods:

# kubectl get pod -n ingress-nginx
NAME                                 READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create-fbh5n 0/1     Completed   0          5m41s
ingress-nginx-admission-patch-xttkh 0/1     Completed   0          5m41s
ingress-nginx-controller-7bd87766fb-lsv89 1/1 Running 0 5m41s

5. Deploy ArgoCD

Add a host entry to access the UI:

192.168.1.200 argocd.idevops.site

Pull required ArgoCD images, retag them, and load into the Kind cluster:

# Get Docker images
docker pull ccr.ccs.tencentyun.com/argocds/dex:v2.35.3
docker pull ccr.ccs.tencentyun.com/argocds/redis:7.0.8-alpine
docker pull ccr.ccs.tencentyun.com/argocds/argocd:v2.6.7

# Tag images
docker tag ccr.ccs.tencentyun.com/argocds/dex:v2.35.3 ghcr.io/dexidp/dex:v2.35.3
docker tag ccr.ccs.tencentyun.com/argocds/argocd:v2.6.7 quay.io/argoproj/argocd:v2.6.7
docker tag ccr.ccs.tencentyun.com/argocds/redis:7.0.8-alpine redis:7.0.8-alpine

# Load images into Kind
images=$(grep image: install.yaml | awk -F 'image: ' '{print $NF}' | sort -n | uniq)
for image in $images; do
  kind load docker-image $image --name devopscluster
done

# Install ArgoCD
kubectl create ns argocd
kubectl -n argocd apply -f install.yaml
kubectl -n argocd apply -f ingress.yaml
sleep 3
kubectl -n argocd get pod
kubectl -n argocd get secret
sleep 5
# Retrieve admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d ; echo

Verify ArgoCD pods are running:

# kubectl -n argocd get pod
NAME                                         READY   STATUS    RESTARTS   AGE
argocd-application-controller-0             1/1     Running   0          7m25s
argocd-applicationset-controller-56bcd8d9c5-8jwq5   1/1     Running   0          7m25s
argocd-dex-server-5c7956f67-zthlg           1/1     Running   0          7m25s
argocd-notifications-controller-d9849775f-vwbn2 1/1   Running   0          7m25s
argocd-redis-6489dcbcd5-kbjhj               1/1     Running   0          7m25s
argocd-repo-server-6c68b85655-s8gkz         1/1     Running   0          7m25s
argocd-server-747b8c84bd-5b9r4              1/1     Running   0          7m25s

With the cluster and ArgoCD ready, participants can start exploring continuous‑delivery workflows as part of the DevOps training.

kubernetesdevopsTerraformInfrastructure as CodeArgoCDKind
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.