mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-15 01:08:58 +03:00
The chapter 'Configuring kubectl for Remote Access' is updated.
This commit is contained in:
@@ -1,25 +1,23 @@
|
|||||||
# Configuring kubectl for Remote Access
|
# Configuring kubectl for Remote Access
|
||||||
|
|
||||||
In this lab you will generate a kubeconfig file for the `kubectl` command line utility based on the `admin` user credentials.
|
In this chapter, you will generate a kubeconfig file for the `kubectl` command line utility based on the `admin` user credentials.
|
||||||
|
|
||||||
> Run the commands in this lab from the same directory used to generate the admin client certificates.
|
> Run the commands in this chapter from the same directory used to generate the admin client certificates.
|
||||||
|
|
||||||
## The Admin Kubernetes Configuration File
|
## The Admin Kubernetes Configuration File
|
||||||
|
|
||||||
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.
|
Each kubeconfig requires a Kubernetes API Server to connect to. To support high availability the IP address assigned to the 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:
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
$ {
|
||||||
KUBERNETES_PUBLIC_ADDRESS=$(gcloud compute addresses describe kubernetes-the-hard-way \
|
KUBERNETES_LB_ADDRESS=10.240.0.10
|
||||||
--region $(gcloud config get-value compute/region) \
|
|
||||||
--format 'value(address)')
|
|
||||||
|
|
||||||
kubectl config set-cluster kubernetes-the-hard-way \
|
kubectl config set-cluster kubernetes-the-hard-way \
|
||||||
--certificate-authority=ca.pem \
|
--certificate-authority=ca.pem \
|
||||||
--embed-certs=true \
|
--embed-certs=true \
|
||||||
--server=https://${KUBERNETES_PUBLIC_ADDRESS}:6443
|
--server=https://$KUBERNETES_LB_ADDRESS}:6443
|
||||||
|
|
||||||
kubectl config set-credentials admin \
|
kubectl config set-credentials admin \
|
||||||
--client-certificate=admin.pem \
|
--client-certificate=admin.pem \
|
||||||
@@ -38,10 +36,10 @@ Generate a kubeconfig file suitable for authenticating as the `admin` user:
|
|||||||
Check the health of the remote Kubernetes cluster:
|
Check the health of the remote Kubernetes cluster:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get componentstatuses
|
$ kubectl get componentstatuses
|
||||||
```
|
```
|
||||||
|
|
||||||
> output
|
The output should look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
NAME STATUS MESSAGE ERROR
|
NAME STATUS MESSAGE ERROR
|
||||||
@@ -55,16 +53,16 @@ etcd-0 Healthy {"health":"true"}
|
|||||||
List the nodes in the remote Kubernetes cluster:
|
List the nodes in the remote Kubernetes cluster:
|
||||||
|
|
||||||
```
|
```
|
||||||
kubectl get nodes
|
$ kubectl get nodes
|
||||||
```
|
```
|
||||||
|
|
||||||
> output
|
The output should look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
NAME STATUS ROLES AGE VERSION
|
NAME STATUS ROLES AGE VERSION
|
||||||
worker-0 Ready <none> 117s v1.12.0
|
worker-1 Ready <none> 117s v1.12.0
|
||||||
worker-1 Ready <none> 118s v1.12.0
|
|
||||||
worker-2 Ready <none> 118s v1.12.0
|
worker-2 Ready <none> 118s v1.12.0
|
||||||
|
worker-3 Ready <none> 118s v1.12.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Next: [Provisioning Pod Network Routes](11-pod-network-routes.md)
|
Next: [Provisioning Pod Network Routes](11-pod-network-routes.md)
|
||||||
|
|||||||
Reference in New Issue
Block a user