A simple golang/gin app deployed to Kubernetes on AWS EKS.
Pulumi does the following:
- Builds the Docker images
- Provisions AWS Container Registry (ECR) instance
- Pushes the images to the ECR instance
- Provisions AWS EKS cluster
- Uses the images to create Kubernetes deployments
-
Install NPM modules:
$ npm install
-
Create a new stack:
$ pulumi stack init prod
-
Set the AWS region and environment variables:
$ pulumi config set aws:region us-west-2 $ pulumi config set hello-go:hello_message "Hello, Pulumi"
-
Run
pulumi up -y
to deploy changes: -
Verify that the EKS instance exists by connecting to it on port
:8889
in a browser window.
To clean up resources, run pulumi destroy -s prod
Grab URNs to target orphaned resources
pulumi stack --show-urns
pulumi destroy --target urn:pulumi:pulumi-aws-ts-k8s-go::hello-go::eks:index:Cluster::eksCluster -y --target-dependents
Interact with EKS cluster
pulumi stack output kubeConfig --show-secrets > kubeconfig
export KUBECONFIG=$PWD/kubeconfig
Stack commands
pulumi stack ls
pulumi stack select prod
pulumi up -s prod
pulumi stack rm prod