You spin up a new Kubernetes cluster, the automation works great—until provisioning hits a wall of permissions. Someone needs to tweak a policy, open a ticket, wait a day, and then finally redeploy. That is the moment you wish CloudFormation and Microk8s spoke the same language out of the box.
CloudFormation handles infrastructure as code for AWS, giving you reproducible stacks and crisp version control. Microk8s, meanwhile, is the lightweight, single-node Kubernetes that runs anywhere—from a laptop to an air-gapped data center. Each tool is powerful alone, but together they can create a hybrid provisioning model. One keeps your declarative state in check, the other manages localized workloads without Amazon overhead. The trick is wiring them properly.
The key is to let CloudFormation define your network, IAM roles, and persistent storage while Microk8s manages compute workloads closer to your edge or dev environment. You’re essentially splitting the locus of control. AWS builds the bones; Microk8s runs the muscles. VPCs, subnets, and roles live in CloudFormation templates. Microk8s shows up for the day-to-day: pods, controllers, and application namespaces.
How do I connect CloudFormation and Microk8s?
Federate identity. Use AWS IAM OIDC federation so Microk8s services can authenticate to AWS resources directly. Map the Microk8s service accounts to IAM roles with fine-grained policy scopes. Store credentials with Kubernetes Secrets or, better yet, plug in an external secret manager. The configuration looks routine, but the effect is elegant—Microk8s gets controlled access to AWS APIs without handing around static keys.
Best practices for CloudFormation Microk8s integration
Keep your CloudFormation templates modular. Each resource—network, storage, role—should be a stack that Microk8s can consume independently. Rotate secrets with AWS Secrets Manager and short TTL tokens so idle clusters cannot impersonate production identities. Verify that your kubeconfigs reflect least privilege, and sync role changes using CloudFormation stack updates instead of manual edits.