.kube/config

with KubeContext

Kubernetes
Author

Shane Oh

Published

August 23, 2023

I have set up Minikube on my MacBook for an easy development environment, and at home, I have a Raspberry Pi cluster set up for my homelab. These configurations allow me to access and manage my clusters from anywhere. Specifically, I have properly configured the .kube/config file to enable remote access to the cluster at home.

Below is an example of the configured .kube/config file:

.kube/config

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0...LS0tCg==
    server: https://kubernetes.docker.internal:6443
  name: docker-desktop
- cluster:
    insecure-skip-tls-verify: true
    server: https://121.135.111.111:6443
  name: raspberrypi
- cluster:
    certificate-authority: /Users/shane/.minikube/ca.crt
    extensions:
    - extension:
        last-update: Sun, 20 Aug 2023 17:04:00 KST
        version: v1.30.1
        provider: minikube.sigs.k8s.io
      name: cluster_info
    server: https://127.0.0.1:60544
  name: minikube

The above configuration file defines three clusters:

With this configuration file, you can easily access various clusters using the kubectl command. For example, to access the Raspberry Pi cluster, you can use the following command:

kubectl config use-context raspberrypi

To bypass the process of verifying the SSL certificate as a public certificate, use the following command:

- cluster:
    insecure-skip-tls-verify: true