Merge pull request #4046 from mingzhaodotname/patch-1

Add instructions on how to setup kubectl when using kubeadm to Create a Cluster
pull/6048/head
Joseph Heck 2017-10-25 17:06:04 -07:00 committed by GitHub
commit 1b5364e87f
1 changed files with 10 additions and 0 deletions

View File

@ -178,6 +178,16 @@ as root:
kubeadm join --token <token> <master-ip>:<master-port> --discovery-token-ca-cert-hash sha256:<hash>
```
To make kubectl work for your non-root user, you might want to run these commands (which is also a part of the `kubeadm init` output):
```
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
```
Alternatively, if you are the root user, you could run this:
```
export KUBECONFIG=/etc/kubernetes/admin.conf
```
Make a record of the `kubeadm join` command that `kubeadm init` outputs. You
will need this in a moment.