Configure kubectl to use a remote Kubernetes cluster on windows

12/14/2018

I am trying to configure kubectl to use a remote Kubernetes cluster on my local windows machine following the "Install with Chocolatey on Windows" tutorial. However, I am not quite sure how to fill the config file. It should look like this somehow:

apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []

or this, but I got like no idea how to fill those "variables"

apiVersion: v1
clusters:
- cluster:
    server: https://123.456.789.123:9999
    certificate-authority-data: yourcertificate
  name: your-k8s-cluster-name
contexts:
- context:
    cluster: your-k8s-cluster-name
    namespace: default
    user: admin
  name: default-context
current-context: default-context
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: your-login-token
-- Anton Wagner
chocolatey
config
kubectl
kubernetes
windows

1 Answer

2/11/2019

This variable must be provided by your k8s cluster administrator with special kubeconfig file. After that you can access to you cluster with --kubeconfig <path to you kubeconfig file> options:

kubectl cluster-info --kubeconfig ./.kube/config -v=7 --insecure-skip-tls-verify=true --alsologtostderr
-- Anton Kudinov
Source: StackOverflow