Home » DevOps » Remote access to Minikube with Kubectl

About Eugene Fedorenko

Eugene Fedorenko
I am a Senior Architect at Flexagon focusing on ADF and many other things.

Remote access to Minikube with Kubectl

Let’s say you need to install a Kubernetes cluster in your organization for development and testing purposes. Minikube looks like a perfect fit for that job. It was specially designed for users looking to try out Kubernetes or develop with it day-to-day. It runs a single-node Kubernetes cluster inside a VM on a standalone machine. So, you found a server for that, followed the insulation guide to install a virtual box with Minikube on it and now you can easily deploy pods to the K8s cluster with kubectl from that server. In order to be able to do the same remotely from your laptop you have to do some extra movements:

1.Install kubectl on your laptop if you don’t have it.

2. Copy .minikube folder from the server with Minikube to your laptop (e.g. to /Users/fedor/work/minikube)

3. Update clusters, contexts and users sections in your kubectl config file on your laptop ($HOME/.kube/config) with the following content

apiVersion: v1
clusters:
- cluster:   
    insecure-skip-tls-verify: true
    server: https://YOUR_SERVER:51928
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /Users/fedor/work/minikube/client.crt
    client-key: /Users/fedor/work/minikube/client.key

4. Go to the server and stop Minikube with

minikube stop

5. Forward a port for the Minikube VM from 8443 guest port to 51928 host port.

6. Start Minikube with

minikube start

7. Check from your laptop that it works:

kubectl get pods

That’s it!

Published on System Code Geeks with permission by Eugene Fedorenko , partner at our SCG program. See the original article here: Remote access to Minikube with Kubectl

Opinions expressed by System Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of