Deploy a local Kubernetes cluster with Minikube
The goal of this tutorial is to deploy a local development Kubernetes cluster using minikube and kubetcl.
If you don't have the command minikube, first install it.
I work on a MacOS, so I launch the command brew install minikube
You can check if the binary is well install with this command
minikube version minikube version: v1.30.1 commit: 08896fd1dc362c097c925146c4a0d0dac715ace0
The second think to do is to install the kubectl binary to interact with your cluster.
I use brew, so I launch brew install kubectl
If you don't have a MacOs, please see this link.
I check my kubectl version to be sure
kubectl version --client -oyaml clientVersion: buildDate: "2023-06-14T09:47:38Z" compiler: gc gitCommit: 25b4e43193bcda6c7328a6d147b1fb73a33f1598 gitTreeState: clean gitVersion: v1.27.3 goVersion: go1.20.5 major: "1" minor: "27" platform: darwin/arm64 kustomizeVersion: v5.0.1
Now we can start the cluster
minikube start 😄 minikube v1.30.1 sur Darwin 13.4.1 (arm64) ▪ KUBECONFIG=/tmp/config-1689600714 ✨ Utilisation du pilote docker basé sur le profil existant 👍 Démarrage du noeud de plan de contrôle minikube dans le cluster minikube 🚜 Extraction de l'image de base... 🏃 Mise à jour du container docker en marche "minikube" ... 🐳 Préparation de Kubernetes v1.26.3 sur Docker 23.0.2... 🔎 Vérification des composants Kubernetes... ▪ Utilisation de l'image docker.io/kubernetesui/dashboard:v2.7.0 ▪ Utilisation de l'image gcr.io/k8s-minikube/storage-provisioner:v5 ▪ Utilisation de l'image docker.io/kubernetesui/metrics-scraper:v1.0.8 💡 Certaines fonctionnalités du tableau de bord nécessitent le module metrics-server. Pour activer toutes les fonctionnalités, veuillez exécuter : minikube addons enable metrics-server 🌟 Modules activés: storage-provisioner, default-storageclass, dashboard 🏄 Terminé ! kubectl est maintenant configuré pour utiliser "minikube" cluster et espace de noms "default" par défaut.
Your kubectl configuration is generated and ready to use.
kubectl config current-context minikube
You are connect to a cluster named minikube.
You can use kubectl to check node
kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready control-plane 4d22h v1.26.3
Congratulations ! you have now a kubernetes cluster and you are ready to work on it.
Sometimes you need to work on multiple cluster(s) at same time, for test connectivity for example.
With minikube, you can do it easily with profiles.
Create first cluster named cluster1 minikube start -p cluster1 Create second cluster named cluster2 minikube start -p cluster2 List all existing cluster(s) minikube profile list Switch context to cluster1 minikube profile cluster1 minikube update-context