DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Dynamic Forms With Camunda and Spring StateMachine
  • The Impact of Asynchronous Work on Engineering Innovation
  • Structured Logging in Spring Boot 3.4 for Improved Logs
  • Symbolic and Connectionist Approaches: A Journey Between Logic, Cognition, and the Future Challenges of AI

Trending

  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 2
  • Operational Principles, Architecture, Benefits, and Limitations of Artificial Intelligence Large Language Models
  • Endpoint Security Controls: Designing a Secure Endpoint Architecture, Part 2
  • Data Quality: A Novel Perspective for 2025
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Access Minikube Using Kubectl From Remote Machine

Access Minikube Using Kubectl From Remote Machine

Check out this article if you want to learn how to access Minikube development cluster with kubectl client, just like your access Kubernetes cluster to test your deployments.

By 
Kuljeet Singh user avatar
Kuljeet Singh
DZone Core CORE ·
Aug. 31, 20 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
20.7K Views

Join the DZone community and get the full member experience.

Join For Free

What Is Minikube?

Minikube is a tool that makes it easy to run Kubernetes locally. It runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day. 

Installing Minikube

If you do not have a minikube setup just use the below link to setup. 

https://kubernetes.io/docs/setup/learning-environment/minikube/

Install Kubectl

 It will help you connect to the minikube API server and schedule deployments. 

curl -LO "https://storage.googleapis.com/kubernetes-release/release/

$(curl -s https://storage.googleapis.com/kubernetes-release/release/

stable.txt)/bin/linux/amd64/kubectl"

Apply Port Forwarding in Network Settings

Once the setup is done open the network setting of minikube in VirtualBox and adds port forwarding to 8443. Port 51928 is mapped to 8443 of minikube in network settings below. 

minikube

Start Minikube 

The next step is to start a minikube. Take a note of the IP address of your machine, for me, it was 192.168.0.101.

minikube start — apiserver-ips=192.168.0.101

minikube start --apiserver-ips=192.168.0.101

Copy the Certificates and Key Files To Remote Machine

Copy ca.crt, client.crt and client.key to the remote machine and it has kubectl client, they are marked as yellow below. Please note both machines should be on the same network. 

apiserver

Run Base64 Encode

On remote machine Base64 encode the 3 files ca.crt, client.crt and client.crt and create a config file(location of config file is $HOME/.kube/config) with following content. 

Java
 




x
19


 
1
apiVersion: v1
2
clusters:
3
- cluster:
4
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQVRBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERS0tLS0tCg==
5
server: https://192.168.0.101:51928
6
name: minikube
7
contexts:
8
- context:
9
cluster: minikube
10
user: minikube
11
name: minikube
12
current-context: minikube
13
kind: Config
14
preferences: {}
15
users:
16
- name: minikube
17
user:
18
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURBRENDQWVpZ0F3SUJBZ0lCQWpBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFEBVEUtLS0tLQo=
19
 client-key-data: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBcDM2eVJMNmt6cXVvQVBQWkxQNmlXNlZ1WHBteVZUeTBsR3pmUX0tLQo=



Replace Content of Following Keys With base64 Encoded Content in Kube Config File Above

certificate-authority-data: with base64 encoded ca.crt

client-certificate-data: with base64 encoded client.crt

client-key-data: with base64 encoded client.key

Access the Cluster  

You can now run the kubectl command to access this minikube cluster.

kube-system

Credits for help in starting minikube: 

https://github.com/kubernetes/minikube/issues/1974#issuecomment-360197415

Machine remote

Opinions expressed by DZone contributors are their own.

Related

  • Dynamic Forms With Camunda and Spring StateMachine
  • The Impact of Asynchronous Work on Engineering Innovation
  • Structured Logging in Spring Boot 3.4 for Improved Logs
  • Symbolic and Connectionist Approaches: A Journey Between Logic, Cognition, and the Future Challenges of AI

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!