You’ve spun up a lightweight Kubernetes cluster with k3s and want to deploy code straight from GitHub. Simple in theory, right? Yet somewhere between your repo, tokens, and cluster permissions, things start getting less fun. Automating deployments shouldn’t feel like a scavenger hunt across YAML files.
At its core, k3s is Kubernetes stripped down and optimized for edge and dev environments. GitHub, with its Actions and workflows, is the perfect partner for managing continuous delivery. Together, they enable an elegant loop: commit, build, deploy, verify. But only if you connect them with the right security and automation model.
A working GitHub k3s setup begins with trust. You need a service account or identity that GitHub Actions can assume without leaving behind hardcoded keys. Using OIDC federation, GitHub can request short-lived credentials from your cloud (AWS, GCP, or Azure) that map directly to roles used by k3s. It’s like giving your CI pipeline a temporary visitor badge instead of a skeleton key.
Once authenticated, your workflow can use kubectl or Helm to apply manifests to k3s. The k3s agent receives them, spins up pods, and updates workloads within seconds. You avoid the traditional dance of SSH keys or long-lived secrets. With RBAC configured properly, you can even restrict which namespaces each workflow touches.
Quick Answer: How do I connect GitHub and k3s?
Use GitHub Actions with OIDC to request temporary credentials from your cloud provider, map those to a k3s cluster role, and deploy via kubectl or Helm. This method eliminates hardcoded tokens and keeps deployments verifiable and auditable.