Exercise - Deploying Stuff to Kubernetes
In this exercise we will create a local Kubernetes cluster and deploy manifests to it using a GitOps engine called ArgoCD.
Prereqs
Make sure you have the following tools installed and up to date:
-
docker - For building containers and running k8s with
kind
. - kind - For creating local k8s clusters.
- kubectl - For interacting with k8s.
- kustomize - For templating k8s manifests.
Setup
Define the environment.
export ENV=non-prod
export CLUSTER=non-east-a
Create a local cluster representing this environment.
kind create cluster --name $CLUSTER
Bootstrap the Cluster
Install the GitOps engine.
kustomize build "https://github.com/codeformio/k8s-cluster-config/base/argocd?ref=$ENV" | kubectl apply -f -
Configure the GitOps engine.
kustomize build "https://github.com/codeformio/k8s-gitops-config/$ENV/$CLUSTER?ref=$ENV" | kubectl apply -f -
Login to UI
The ArgoCD UI can be used to view the application. By default the password for the admin
user is set to the server’s pod name.
kubectl get pods -n argocd
Port forward and login by visiting https://localhost:8080.
kubectl port-forward -n argocd svc/argocd-server 8080:443
Port forward the application’s port to see it respond.
kubectl port-forward -n greeter svc/hello-api 8000:80
In another terminal…
curl localhost:8000 -v
Update an Application
TODO
Deploy an Updated Application
TODO
Cleanup
Delete the local cluster.
kind delete cluster --name $CLUSTER