Skip to content

Kubernetes and Argo CD

Outcome

Built a three-node K3s cluster on Rocky Linux 9 and connected it to a small GitHub Actions and Argo CD delivery pipeline. A change to a static website now moves from a Git commit, through tests and a container build, into the cluster without copying files to a server or giving GitHub Actions a kubeconfig.

Why I built it

I built this as a practical project with a strong DevOps focus. So this lab concentrated on: operating Kubernetes and explaining a release from source commit to a running workload.

Rocky Linux 9 Minimal was a good fit because it stays close to the RHEL administration model while remaining freely available for the lab.

The completed flow is:

flowchart LR
    DEV["Debian management VM"] -->|"git push"| GH["GitHub repository"]
    GH --> CI["GitHub Actions<br/>test · build · smoke test"]
    CI --> GHCR["GitHub Container Registry<br/>immutable SHA image"]
    CI -->|"commit image tag"| GIT["Kubernetes manifests in Git"]
    GIT --> ARGO["Argo CD"]
    ARGO --> K8S["K3s cluster"]
    GHCR --> K8S
    K8S --> APP["Two application replicas<br/>Traefik Ingress"]

Current environment

Component Role Current state
k8s-cp-01 K3s server and control plane Ready; ordinary application workloads are blocked by a control-plane taint
k8s-worker-01 K3s agent and application worker Ready; runs one application replica
k8s-worker-02 K3s agent and application worker Ready; runs one application replica
K3s Kubernetes distribution v1.36.4+k3s1 during implementation
Traefik Ingress controller installed with K3s Routes the internal application hostname
Argo CD GitOps controller v3.5.3; application is automated, self-healing, and pruning-enabled
GitHub Actions Continuous integration Tests, builds, smoke-tests, publishes, and records the new image tag
GHCR Container registry Public lab image tagged with the full source commit SHA

The node addresses remain in the private IPAM. Public examples use VLAN 20 in 10.42.20.0/24, while Kubernetes uses 10.244.0.0/16 for pods and 10.96.0.0/16 for Services.

Build phases

Phase Result
1. Rocky Linux and network foundation Created three right-sized VMs, stable addressing, internal DNS, time synchronization, SELinux, and firewall prerequisites
2. K3s cluster Installed the server and two agents, labelled workers, tainted the control plane, and validated cluster services
3. Application deployment Deployed two replicas with health probes, resource controls, a ClusterIP Service, and Traefik Ingress
4. GitHub Actions and GHCR Added source tests, a container smoke test, immutable image publication, and automatic manifest updates
5. Argo CD and GitOps Declared the application in Git, enabled automated reconciliation, and demonstrated self-healing
6. End-to-end release and troubleshooting Released a styled application change, diagnosed a scheduling deadlock, and completed the rolling update

Rebuild order

Follow the phases in order when recreating the lab:

  1. Create the three VMs and complete OPNsense DHCP, DNS, and firewall work.
  2. Install the K3s server and join both workers.
  3. Create the GitHub repository and deploy the first image manually.
  4. Confirm GitHub Actions can test, build, publish, and update the manifest.
  5. Install Argo CD and register argocd/application.yaml.
  6. Change app/index.html and trace the complete automated release.

Each phase contains the commands, expected evidence, failure checks, and links to the relevant vendor documentation. Application and manifest contents remain in the application repository so this site does not become a second, stale copy of the source.

Skills learned/learning

  • Build and validate a small Kubernetes cluster on on-premises virtual machines.
  • Explain the difference between a control-plane node and worker nodes.
  • Work with namespaces, Deployments, ReplicaSets, pods, Services, Ingress, labels, selectors, taints, readiness probes, and liveness probes.
  • Distinguish the pod network, Service network, node network, and client access path.
  • Build an immutable container artifact in CI and publish it to GHCR.
  • Keep cluster credentials out of GitHub Actions by using a pull-based GitOps controller.
  • Explain the difference between Argo CD reconciliation and Kubernetes workload self-healing.
  • Read events and Deployment conditions to diagnose a pod that remains Pending.
  • Perform an observable rolling update while keeping existing replicas available.

Access path

The application remains internal:

VPN or trusted internal client
  -> OPNsense policy
  -> internal DNS name
  -> selected K3s ingress node on TCP 80
  -> Traefik
  -> ClusterIP Service
  -> ready application pod

There is no public HTTP port forward. Argo CD administration uses an SSH tunnel and local port-forward rather than a permanently exposed management interface.

Important limitations

This is a learning cluster, not a production platform:

  • all three VMs share one physical Proxmox host
  • the Kubernetes control plane and datastore are not highly available
  • internal DNS currently points at one ingress node rather than a redundant virtual IP
  • the application uses internal HTTP rather than managed TLS
  • the demonstration image is public
  • CI commits the deployment tag directly to main
  • Argo CD uses the default project rather than SSO, restricted projects, and production RBAC
  • persistent-data recovery, admission policy, signature enforcement, centralized logs, and production alerting are not part of this phase

These trade-offs keep the environment small enough for the current host while still demonstrating the delivery and operational concepts that matter.