To understand what you need in your local machine's ~/.kube/config
file, checkout the ~/.kube/config
file on the remote VM itself.
You'll find that you need to add these 3 items in your local machine's ~/.kube/config
file:
- A cluster under clusters
- A context under contexts
- A user under users
To add these 3 items, first you need to copy these 3 files from remote VM to your local machine:
- ca.crt (usually found at
~/.minikube/profiles/minikube/ca.crt
)
- client.crt (usually found at
~/.minikube/profiles/minikube/client.crt
)
- client.key (usually found at
~/.minikube/profiles/minikube/client.key
)
Now, you need to base64 encode these 3 files. For example, if you're on macOS, you can use this command:
base64 -i <input_file> -o <output_file>
Now you're ready to update your local machine's ~/.kube/config
file.
- Add this cluster under clusters:
- cluster:
certificate-authority-data: <base64 of ca.crt file>
server: <same ip as remote VM's kubeconfig file, since you've used vm-driver=none>
name: minikube
- Add this context under contexts (same values as remote VM)
- context:
cluster: minikube
user: minikube
name: minikube
- Add this user under users
- name: minikube
user:
client-certificate-data: <base64 of client.crt file>
client-key-data: <base64 of client.key file>