Minikube (Kubernetes) – Create and Use Multiple Clusters

Minikube is a great way to play with Kubernetes clusters in a quick way. But what if you want to have multiple Kubernetes clusters to play around with? You can use Minikube to start multiple clusters and then switch between them.

Create Two Clusters

Let’s create two clusters, we’re also going to be setting the CPU, memory and disk size that is available to them, you can choose whatever figures you like for these.

minikube start --cpus=4 --memory=8192 --disk-size=100g -p cluster1
minikube start --cpus=4 --memory=8192 --disk-size=100g -p cluster2

Swap Between Clusters

To swap between clusters all you need to do is run one of the commands:

minikube profile cluster1

or 

minikube profile cluster2

Examine Cluster Profiles

To see what cluster profiles you have, you can use:

minikube profile list

As you can see, I currently have two running clusters, one called hpa-cpu and one called minikube, using the above commands however you’d have two, one called cluster1 and one called cluster2.

You can also see which is active, therefore which your Kubectl commands will point to.

Leave a comment