Atlantis - Setting up in Kubernetes without sensitive values
In this article we are going to explore setting up Atlantis in Alibaba. You can also set it up in AWS EKS. This tutorial is slightly different than most whereby we focus on not storing the sensitive password in the yaml file but reference it within the Kubernetes secret.
To Install
First go to Alicloud to create a user dev-atlantis-user, get the AccessKeyId and AccessKeySecret. Ensure that it has sufficient right to create resources. Usually admin rights but do pick the admin rights you want to provide.
Next in your kubernetes cluster create a namespace called atlantis
kubectl create namespace atlantis
In Atlantis create a secret called dev-atlantis-user, put in your AccessKeyID and AccessKeySecret
kubectl create secret generic dev-atlantis-user \ --from-literal=AccessKeyID=admin123 \ --from-literal=AccessKeySecret='S!B\*d$zDsb='
In Atlantis namespace create a secret called dev-atlantis-web-secrets. This is to store the username and password when entering Atlantis at the website level
kubectl create secret generic dev-atlantis-web-secrets \ --from-literal=username=admin \ --from-literal=password='S!B\*d$zDsb='
Next go to Github and create a PAT Token.
In the Terraform repository, in this demo I am using github.com/squid-labs/dev-infrastructure, point to the repo you want Atlantis to monitor, add in the Webhook secret. The value of the webhook secret is something you can generate by yourself.
In Atlantis namespace create a secret called dev-atlantis-github-webhook-secrets. This is to access to the github repository and make changes.
kubectl create secret generic dev-atlantis-github-webhook-secrets \ --from-literal=ATLANTIS_GH_USER=admin \ --from-literal=ATLANTIS_GH_WEBHOOK_SECRET='S!B\*d$zDsb=' \ --from-literal=ATLANTIS_GH_TOKEN='S!B\*d$zDsb='
Atlantis has an official Helm chart
Add the runatlantis helm chart repository to helm
helm repo add runatlantis https://runatlantis.github.io/helm-charts
cd
into a directory where you're going to configure your Atlantis Helm chartCreate a
values.yaml
file by runninghelm inspect values runatlantis/atlantis > values.yaml
This is where we need to configure the variables, pay attention to the variables especially your domain. Get the script here
In your Kubernetes cluster, run
helm install atlantis runatlantis/atlantis -f values.yaml -n atlantis
After that remember to point your domain to the ip of the pod. In Alicloud usually it is the ClusterIP which the IP will be permanent.
For the rest on how it looks refer to this