Adapt public IP gathering and other

pull/582/head
Nemo 2020-06-20 15:36:15 +02:00
parent d7c532c051
commit 0272261ad7
1 changed files with 15 additions and 19 deletions

View File

@ -8,29 +8,25 @@ In this lab you will generate a kubeconfig file for the `kubectl` command line u
Each kubeconfig requires a Kubernetes API Server to connect to. To support high availability the IP address assigned to the external load balancer fronting the Kubernetes API Servers will be used.
Generate a kubeconfig file suitable for authenticating as the `admin` user:
Generate a kubeconfig file suitable for authenticating as the `admin` user (replace MY_PUBLIC_IP_ADDRESS with your public IP address on the `gateway-01` VM):
```bash
{
KUBERNETES_PUBLIC_ADDRESS=$(gcloud compute addresses describe kubernetes-the-hard-way \
--region $(gcloud config get-value compute/region) \
--format 'value(address)')
KUBERNETES_PUBLIC_ADDRESS=MY_PUBLIC_IP_ADDRESS
kubectl config set-cluster kubernetes-the-hard-way \
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 \
kubectl config set-credentials admin \
--client-certificate=admin.pem \
--client-key=admin-key.pem
kubectl config set-context kubernetes-the-hard-way \
kubectl config set-context kubernetes-the-hard-way \
--cluster=kubernetes-the-hard-way \
--user=admin
kubectl config use-context kubernetes-the-hard-way
}
kubectl config use-context kubernetes-the-hard-way
```
## Verification
@ -41,7 +37,7 @@ Check the health of the remote Kubernetes cluster:
kubectl get componentstatuses
```
> output
> Output:
```bash
NAME STATUS MESSAGE ERROR
@ -58,7 +54,7 @@ List the nodes in the remote Kubernetes cluster:
kubectl get nodes
```
> output
> Output:
```bash
NAME STATUS ROLES AGE VERSION