From 853dfe84319e21ca3e9187ff61701d7fdbfa817f Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Tue, 30 Oct 2018 16:34:00 +1100 Subject: [PATCH] configure kubectl to connect remote cluster --- categories/devops/kubernetes.md | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/categories/devops/kubernetes.md b/categories/devops/kubernetes.md index f8cccc7..170787f 100644 --- a/categories/devops/kubernetes.md +++ b/categories/devops/kubernetes.md @@ -92,3 +92,39 @@ kubectl cluster-info http://your_ip:8080/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ ``` + +## Configure Kubectl to access remote Kubernetes cluster + +Here is a very simple config which use HTTP and `not secure`, should only for local testing purpose + +### Config + +Having a yaml file called `config-demo` in your current folder + +```yaml +apiVersion: v1 +clusters: +- cluster: + server: http://your_cluster_ip:8080 + name: development +contexts: +- context: + cluster: development + namespace: dev + user: developer + name: dev +current-context: dev +kind: Config +preferences: {} +users: +- name: developer +``` + +### Connect to remote cluster + +```bash +kubectl get all --kubeconfig=config-demo --all-namespaces +``` +For long term usage, you will need to copy the content to your `~/.kube/config` + +TODO: Setup SSL connection