DevOps Onboarding
Here’s how you get setup for Devops development on your local machine
Repos
These are the 3 repos that are currently in use
- terraform : Represents Azure resources as code
- argocd : Configuration for deploying and updating kubernetes
- star-server-infra : Terraform for current Azure stack. This will be deprecated in favor of terraform later
The vision is to represent all our services using Kubernetes (including star.vote but also all Equal Vote Projects), and the Azure resources will be the minimum necessary for supporting Kubernetes
Local Software
Install the following CLI clients
- Azure CLI : For managing Azure resources
- kubectl: For managing Kubernetes cluster
- Terraform: For deploying terraform configuration to Azure
- Helm: A tool for installing kubernetes configurations from the community (Kubernetes equivalent of brew or pip install)
For Windows Only: I recommend creating a bin foler under
C:\Users\<your user>\bin
, then to add it to your path search “Edit the system environment variables” > “Environment Variables…” > “Path” and add the folder
Add equalvote cluster to your kubeconfig
The following command will open a browser for you to login
az aks get-credentials --resource-group equalvote --name equalvote
Create your own namespace in Kubernetes
This allows you to experiment and create resources under your namespace without affecting the rest of the stack.
Create Namespace
kubectl create ns <your name>
Set namespace to be the default
kubectl config set-context --current --namespace=<your name>
All future commands will use your namespace by default, but if you wall to look at other namespaces you can add flags
Some examples
kubectl get pods -n=default # View pods in the default namespace
kubectl get pods -A # View pods across all namespaces
Deploying a new Service in Kuberneties
NOTE: This method is for adhoc deployments and experiments. To formally introduce a service into production this should be represented in code in the argocd repo
If you want to deploy a new service (ex. Keycloak or Matomo), here’s what you do
-
Search for a corresponding helm chart on Artifact Hub, but if you can find an official helm chart on the service’s website even better
-
Install helm chart
helm install <name of service> <chart name> -n <optional namespace>
# example
helm install matomo bitname/matomo -n namespace
- Verify Deployment
List the pods to check on which pods were added, and verify that they’re all in the running state
kubectl get pods -A
Adding a service to ArgoCD
TODO
Educational Resources
- Cloud Native Landscape: Coalition of open source projects. CNCF helps guide which projects are mature (“graduated”) and ready for production use
- Kubernetes Crash Course
- kubectl Cheat Sheet