This repository contains code that I'm using to learn and experiment with Kubernetes.
- minikube
- kubectl
- docker (for macOS)
- python 3.7 (via Anaconda)
I use GCP for production deployments, so I'm installing kubectl and minikube from gcloud to avoid version discrepancies.
Homebrew can also be used to install kubectl and minikube.
# Install kubectl and minikube via gcloud
gcloud components install kubectl;
gcloud components install minikube;
# Make sure we have the latest versions of kubectl and minikube
gcloud components update;
Follow the instructions here: https://docs.docker.com/docker-for-mac/install/
# Starts a node Kubernete cluster using Virtualbox/VMWareFusion
minikube start;
# Enables a plugin that allows minikube to use a local docker repository,
# so we don't have to use DockerHub or GCR.
minikube addons enable registry;
# Enables an nginx frontend that will route incoming requests to different services
minikube addons enable ingress;
conda create --name kubernetes-experiment python=3.7;
conda activate kubernetes-experiment;
Kubernetes comes with an admin dashboard that shows information about the cluster, such as what pods are running and what jobs have run.
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc5/aio/deploy/recommended.yaml;
In order to access the dashboard, we need to create an admin account and give the account the cluster-admin role.
kubectl apply -f kubernetes/kube-dash/admin-user.yaml;
kubectl apply -f kubernetes/kube-dash/cluster-role.yaml;
To view the dashboard, we need to run this command in a separate terminal:
kubectl proxy
Now we can view the dashboard at: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
To log in to the web UI we need to get an access token, which can be done with this command:
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
Copy and paste this token into the web UI.