Skip to content

Instantly share code, notes, and snippets.

@Minish144
Last active January 21, 2023 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Minish144/aa9b59a198fa1d9f2f1319aa4bb58f53 to your computer and use it in GitHub Desktop.
Save Minish144/aa9b59a198fa1d9f2f1319aa4bb58f53 to your computer and use it in GitHub Desktop.
Minikube remote access
  1. Run the minikube
minikube start --nodes 1
  1. Proxy and expose kubernetes server api
kubectl proxy --address='0.0.0.0' --accept-hosts='^*$'
  1. Expose the proxy port to access your cluster from outside
  2. Copy your k8s config to the remote machine from ~/.kube/config and place it wherever you want
  3. Edit the config:
  • Change the cluster's ip in the config:
...
clusters:
- cluster:
    extensions:
    - extension:
        last-update: Wed, 16 Feb 2022 22:11:43 MSK
        provider: minikube.sigs.k8s.io
        version: v1.21.0
      name: cluster_info
    server: http://<your-ip>:8001
  name: minikube
...
  • If you dont wanna copy your certs:
    • Add insecure-skip-tls-verify: true to your cluster params:
          name: cluster_info
      insecure-skip-tls-verify: true
      server: http://<your-ip>:8001
    name: minikube
    • Delete certificate-authority, client-certificate and client-key lines from the config
  1. Tell k8s where your config is
export KUBECONFIG=<config-path>

or add to your shell config (.zshrc, .bashrc etc.)

  1. Use the context in k8s
kubectl config use-context minikube
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment