Step-by-Step Guide: Setting-up Kubernetes Cluster in Rancher Desktop

Ashok Gudise
4 min readJul 1, 2023

If you’re searching for free alternatives to Docker Desktop and need a solution, you’ve arrived at the ideal spot. Rancher Desktop provides developers with a user-friendly tool to efficiently run and manage Kubernetes clusters on their local machines.

Welcome to this concise yet comprehensive blog! It offers step-by-step instructions to install Kubernetes in Rancher Desktop, empowering you to effortlessly create and test Kubernetes applications in your local environment. Let’s get started!

Step 1: Download Rancher Desktop

You can download it from the Official Rancher Desktop website and follow the installations instructions for your OS.

Step 2: Customize your preferences

To access the configuration popup and customize your settings, click on the Settings button located on the right-hand side (highlighted below).

You can increase or decrease system resources like cpu and memory under Virtual Machine tab (Preferences -> Virtual Machine -> Hardware).

Switch to dockerd (Optional)

If you feel more at ease and are already familiar with Docker commands, I recommend switching to dockerd in the Container Engine section below.

Enable Kubernetes

Navigate to the next tab labeled “Kubernetes,” then select the “Enable Kubernetes” option. Please wait while Rancher Desktop reloads the settings to apply the changes.

Step 3: Setup a Kubernetes Cluster

Verify Kubernetes Default Config

Open your terminal (Command Prompt) and type below command to check default config

vi ~/.kube/config

After executing the command, you should observe an output similar to the following.

apiVersion: v1
kind: Config
clusters:
- name: rancher-desktop
cluster:
server: https://127.0.0.1:6443
certificate-authority-data: #some generated content here
insecure-skip-tls-verify: false
users:
- name: rancher-desktop
user:
client-certificate-data: #some generated content here
client-key-data: #some generated content here
contexts:
- name: rancher-desktop
context:
cluster: rancher-desktop
name: rancher-desktop
user: rancher-desktop
preferences: {}
current-context: rancher-desktop

Verify Installation

You can check Kubernetes version by using below command.

kubectl version --short

You should see something like below.

Deploy Something

Deploy a sample App on Kubernetes with below command.


#Create Deployment
kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1

#Get the Deployment
kubectl get deployments

If everything goes well, you should encounter output similar to the content displayed below.

Create a Proxy

Run below command to create a proxy, which will forward the traffic into the cluster private network and you can terminate this any time with Control+C

kubectl proxy

You can access the app once you see below message.

Test your App

Open your browser and try this url or you can curl the same.

http://localhost:8001/version

Result will be similar to the below shown.

Step 4: Wrap

After confirming that everything is functioning correctly, you can proceed to delete the newly created app using the command provided below.

kubectl delete deployments/kubernetes-bootcamp

For further exploration and experimentation with cluster management, you can refer to the official documentation here: https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/

If you found my blog posts enjoyable and gained new insights, I kindly ask you to think about sharing them and joining me here for future updates.

That’s all for now, Happy Learning!

--

--

Ashok Gudise

I am an enthusiastic learner who is curious to learn new market trends and new technologies that make software engineering much more robust and easy to learn.