[HARDWAY] 10. Configuring kubectl for Remote Access
https://github.com/kelseyhightower/kubernetes-the-hard-way/blob/master/docs/10-configuring-kubectl.md
kubectl 명령어를 remote 에서 사용하기위한 kubeconfig 구성
kubectl config set-cluster kubernetes-the-hard-way \
--certificate-authority=ca.pem \
--embed-certs=true \
--server=https://${KUBERNETES_PUBLIC_ADDRESS}:6443
kubectl config set-credentials admin \
--client-certificate=admin.pem \
--client-key=admin-key.pem
kubectl config set-context kubernetes-the-hard-way \
--cluster=kubernetes-the-hard-way \
--user=admin
kubectl config use-context kubernetes-the-hard-way
위의 ${KUBERNETES_PUBLIC_ADDRESS} 값은 위의 링크에서는 GCP 의 LB 값으로 되어 잇으나, virtualbox 에서는 Haproxy 로 구성된 IP 로 넣어준다.
ex) kubectl config set-cluster kubernetes-the-hard-way \
--certificate-authority=ca.pem \
--embed-certs=true \
--server=https://192.168.1.47:6443
### 확인
[root@master01 ~]# kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-2 Healthy {"health":"true"}
etcd-0 Healthy {"health":"true"}
etcd-1 Healthy {"health":"true"}
[root@master01 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
worker01 Ready <none> 2d2h v1.18.6
worker02 Ready <none> 2d2h v1.18.6
worker03 Ready <none> 2d2h v1.18.6
worker04 Ready <none> 53m v1.18.6