π How to Connect Rancher to Minikube in GitHub CodeSpaces π
Have you ever wanted to manage your Kubernetes cluster using Rancher within a GitHub CodeSpace environment? Well, you're in luck! π In this post, I will walk you through how to set up Minikube on CodeSpaces and connect it to Rancher for seamless cluster management.
π‘ What You Will Achieve:
-
Step 1: Setting up Minikube in GitHub CodeSpaces
-
Step 2: Deploying Rancher to manage the cluster
-
Step 3: Connecting Rancher to the Minikube instance
π οΈ Step 1: Setting up Minikube in GitHub CodeSpaces
First things first, ensure you have Minikube installed in your CodeSpace. If not, you can install it using the following steps:
Install Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& sudo install minikube /usr/local/bin/
Start Minikube
minikube start --driver=none
This will install Minikube and launch it within your CodeSpace using the none driver.
π‘ Tip: Make sure to check if the Minikube cluster is running:
minikube status
π Step 2: Deploy Rancher to Manage Minikube
Now that your Minikube cluster is running, let's deploy Rancher to manage the cluster.
- Install Helm:
Helm is used to install Rancher.
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- Add Rancher Chart Repo:
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo update
- Install Rancher:
Deploy Rancher on Minikube:
kubectl create namespace cattle-system
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=rancher.local
βΈοΈ Pause for Screenshot: Hereβs a screenshot of the Helm install process!
Once Rancher is up and running, you can access the Rancher UI by creating a tunnel to your localhost:
kubectl port-forward -n cattle-system svc/rancher 8080:80
Now, Rancher will be accessible on http://localhost:8080.
π€ Step 3: Connect Rancher to Minikube
Now that Rancher is running, you can connect it to your Minikube cluster by following these steps:
-
Login to Rancher: Access Rancher through the port-forwarded address.
-
Add a Cluster: In the Rancher dashboard, navigate to "Clusters" and choose Import Existing Cluster.
-
Copy the Command: You will be given a command to run inside your Minikube cluster.
-
Run the Command:
kubectl apply -f
π₯οΈ Pause for Screenshot: Hereβs a screenshot of Rancher importing the Minikube cluster!
And there you go! Rancher is now managing your Minikube cluster π.
π Connect with Me:
Feel free to reach out if you have any questions or need help with your Rancher setup. Let's conquer Kubernetes together! π
Imported from rifaterdemsahin.com Β· 2025