This demo showcases how to set up and manage a Kubernetes cluster using modern tools and workflows. You'll learn how to deploy and manage applications with Headlamp and ArgoCD, and expose them to the outside world using an Ingress controller. By the end of this session, you'll have a fully functional Kubernetes environment and a clear understanding of how these tools can simplify cluster management and application deployment.
By the end of this demo, you will:
- Set up a Kubernetes cluster with Minikube.
- Install and use Headlamp for cluster management.
- Use KRO to define a Set of ResourceGraphDefinitions
- Deploy a sample application using ArgoCD.
- Access the application via an Ingress controller.
- Install
kubectl,helm, andbrewon your machine. - Ensure Minikube is installed and running (
brew install minikube). - Clone this repository and navigate to the directory:
git clone https://github.com/yegli/kubecon-demo.git cd kubecon-demo
- install minikube:
brew install minikube
- run minikube cluster:
minikube start --driver=docker --addons=metrics-server --nodes=3
helm repo add headlamp https://kubernetes-sigs.github.io/headlamp/helm install headlamp headlamp/headlamp --namespace headlamp --create-namespace -f values.yamlOnce installed you must setup the appropriate port forwarding to access the UI over local port 8080
export POD_NAME=$(kubectl get pods --namespace headlamp -l "app.kubernetes.io/name=headlamp,app.kubernetes.io/instance=headlamp" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace headlamp $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace headlamp port-forward $POD_NAME 8080:$CONTAINER_PORTNow that your local port forwarding is set up, you can generate your RBAC token for the admin user by following this guide.
Alternatively, you can integrate with an OIDC provider as documented here.
A local installation is best performed using brew for MacOS after which access to different clusters is handled based on the users permissions setout in his kubeconfig.
brew install headlampThe following command will install the newest version of KRO into your cluster based on your current context.
export KRO_VERSION=$(curl -sL \
https://api.github.com/repos/kro-run/kro/releases/latest | \
jq -r '.tag_name | ltrimstr("v")'
)
helm install kro oci://ghcr.io/kro-run/kro/kro \
--namespace kro \
--create-namespace \
--version=${KRO_VERSION}Create a custom namespace:
kubectl create ns argocd
Then through the headlamp UI under Apps section select argo-cd and install it into your new namespace.
Retrieve the Admin User Credentials once the chart has been deployed succesfully:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -dSetup Port Forwarding (when using both headlamp and argocd be sure to map to dedicated local ports)
kubectl port-forward svc/argocd-server -n argocd 8080:443Define your Application Manifests in your Repository. You can find a sample application here: https://code.swisscom.com/yanick.egli/kubecon-demo-manifests#
Add the repository as HTTPS with the Repository URL set to
https://github.com/yegli/kubecon-demo.git
Create an Application for the argocd-root-app subdirectory through the Web UI. This should spin up the following apps
- ResourceGraphsDefinition (collection of all the KRO Custom API definitions)
- Sample App 1 for Team A (default image, ingress enabled, ha enabled)
- Sample App 2 for Team B (custom image, ingress disabled, ha disabled)
Now you got to deploy your first ResourceGraphDefinition and two corresponding applications. You were able to configure both seperately but still profit from the simplicity of using the same Application Template.
Once you are done exporing you can either stop your minikube cluster to resume to your development environment later by running minikube stopor you can completely remove the cluster by running minikube destroy