All posts

The simplest way to make Bitbucket k3s work like it should

Your build just failed again. The container pulled fine, but your cluster never saw the update. You double-check secrets, service accounts, and Git triggers. Everything looks right, yet nothing deploys. That loop of “works on my laptop” has a new villain: access drift between Bitbucket and k3s. Bitbucket manages your source code and CI pipelines. K3s is Kubernetes that fits in your pocket. Marrying them creates a lean automation stack for edge clusters or lightweight test environments. The magi

Free White Paper

End-to-End Encryption + Sarbanes-Oxley (SOX) IT Controls: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

Your build just failed again. The container pulled fine, but your cluster never saw the update. You double-check secrets, service accounts, and Git triggers. Everything looks right, yet nothing deploys. That loop of “works on my laptop” has a new villain: access drift between Bitbucket and k3s.

Bitbucket manages your source code and CI pipelines. K3s is Kubernetes that fits in your pocket. Marrying them creates a lean automation stack for edge clusters or lightweight test environments. The magic comes when your repository events directly apply manifests to k3s with confidence that identity, permissions, and context stay in sync.

The pair works best through a simple logic path: Bitbucket triggers a pipeline whenever you push to main. That pipeline uses a service identity with just enough privilege to talk to your k3s API. The cluster runs your deployment YAML and reports status back. It feels like a full CI/CD engine, stripped of every slow, noisy part. The trick is control of who can do what and where.

To keep things smooth, handle RBAC in k3s as if it were an IAM policy. Use service accounts mapped to namespaces, not global tokens floating around in pipeline variables. Rotate your secrets often and store them in Bitbucket’s secure variables section, or better, use an identity-aware proxy that injects short-lived credentials on demand. One expired token is cheaper than one leaked secret.

Run into pipeline errors like certificate signed by unknown authority? That’s usually a missing CA bundle in your runner container, not a problem with k3s. Fix it once and bake the certs into your image. Another common issue is an incorrect KUBECONFIG path. Explicit paths beat environment guesses every time.

Continue reading? Get the full guide.

End-to-End Encryption + Sarbanes-Oxley (SOX) IT Controls: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

When done right, the integration delivers:

  • Faster commits to cluster deployment, often in under a minute.
  • Clean, auditable change trails aligned with Git history.
  • No hand-managed kubeconfigs lying around on laptops.
  • Simpler onboarding for new developers, since auth is centralized.
  • Instant rollback to last known good state with version tags.

Platforms like hoop.dev turn those access rules into guardrails that enforce policy automatically. Instead of scripting token lifetimes, you define intent once, and every Bitbucket runner inherits the correct scope in real time. It converts “who touched what” from a mystery into a transparent audit trail tied to your identity provider.

This setup also pairs nicely with AI-driven assistants. A copilot that sees your pipeline structure can draft deployment manifests or flag overbroad permissions before they hit production. Just remember, letting an AI access your CI system means applying the same least-privilege model to its tokens as any human user.

How do I connect Bitbucket pipelines to a k3s cluster?
Generate a scoped Kubernetes service account, export its token and cluster context as Bitbucket variables, then have your pipeline step run kubectl apply commands. Store no long-lived credentials, and prefer dynamic injection through a proxy or workload identity.

Once the wiring is tight, every commit feels lighter. Bitbucket builds, pushes, and verifies. K3s runs, scales, and reports. You keep moving without touching a single dashboard.

See an Environment Agnostic Identity-Aware Proxy in action with hoop.dev. Deploy it, connect your identity provider, and watch it protect your endpoints everywhere—live in minutes.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts