minikube icon indicating copy to clipboard operation
minikube copied to clipboard

Can we use two minikube profiles at the same time?

Open Hemanthbhk opened this issue 2 years ago • 3 comments

What Happened?

Can we use two minikube profiles at the same time? instead of switching the profiles, is there any feasibility or possibility to run and deploy for two profiles at time.

Attach the log file

Can we use two minikube profiles at the same time? instead of switching the profiles, is there any feasibility or possibility to run and deploy for two profiles at time.

Operating System

None

Driver

None

Hemanthbhk avatar Dec 24 '22 10:12 Hemanthbhk

Each profile is a cluster (and context), so you are looking for some kind of multi-cluster solution it sounds like ?

afbjorklund avatar Dec 29 '22 19:12 afbjorklund

Here there is a script that create 2 clusters. They share a DNS server(BIND. https://github.com/rogeriomm/minikube-labtools-k8s/blob/master/install/scripts/bind/named.conf.local) on host, so both clusters can resolve names each other and can be interconnected(TCP/IP & DNS)

https://github.com/rogeriomm/minikube-labtools-k8s

rogeriomm avatar Dec 30 '22 21:12 rogeriomm

Here is a tool that manages multiple minikube profiles: https://github.com/RamenDR/ramen/tree/main/test

It is part of the Ramen project since we need to manage multiple interconnected clusters for testing disaster recovery, but the tool is really generic and can be used elsewhere.

nirs avatar Jan 04 '23 23:01 nirs

I need to simulate two indepenent clusters(imagine like two completely indepent customers) that can only talk to each other through public internet and I also want to deploy to each of those clusters in parallel instead of deploying to one and then switching profile and then deploying another. so mini kube multinode solution doesnt do that.

kant777 avatar Jan 05 '23 22:01 kant777

should I just install minukube inside a docker container? that way I can spin up two containers which have their own minukube and kubectl?

kant777 avatar Jan 05 '23 22:01 kant777

@kant777 minikube can create 2 independent clusters out of the box.

Try this:

minikube start -p c1 &
minikube start -p c2 &
wait
minikube profile list
kubectl get deploy -A --context c1
kubectl get deploy -A --context c2

nirs avatar Jan 05 '23 23:01 nirs

@nirs that works!!

kant777 avatar Jan 06 '23 16:01 kant777

can close this issue!

kant777 avatar Jan 06 '23 16:01 kant777

@nirs How can a pod in one profile can talk to another pod in another profile?

kant777 avatar Jan 06 '23 18:01 kant777

In the same way users in different clusters access other clusters. For example if a pod on one cluster can be exposed via a service on the public cluster ip, and pod another cluster can access the other public service.

There are some examples here: https://minikube.sigs.k8s.io/docs/handbook/accessing/

nirs avatar Jan 06 '23 19:01 nirs

@nirs Thanks again for that. I was more trying to understand how that routing would work when I have two minikube ips (one for each profile). Imagine I have pod A in profile A(cluster A) and pod B in profile B(cluster B). podA calls the dns of podB it will first go to kube-dns of cluster A and it will be a miss then it goes to host DNS which should be able to forward to kubedns in cluster B and get it resolved. is that accurate?

kant777 avatar Jan 06 '23 20:01 kant777

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Apr 06 '23 21:04 k8s-triage-robot

As per above comments , we can use two minikube profiles at the same time by following below:

minikube can create 2 independent clusters out of the box.

Try this:

minikube start -p c1 & minikube start -p c2 & wait minikube profile list kubectl get deploy -A --context c1 kubectl get deploy -A --context c2

Hemanthbhk avatar May 05 '23 04:05 Hemanthbhk