mirror of
				https://github.com/kelseyhightower/kubernetes-the-hard-way.git
				synced 2025-11-04 02:02:33 +03:00 
			
		
		
		
	update docs
This commit is contained in:
		@@ -1,28 +1,70 @@
 | 
				
			|||||||
# Configuring Kubectl
 | 
					# Configuring Kubectl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## OS X
 | 
					## Download and Install kubectl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
gcloud compute copy-files \
 | 
					wget https://github.com/kubernetes/kubernetes/releases/download/v1.3.0/kubernetes.tar.gz
 | 
				
			||||||
  controller0:~/kubernetes/platforms/darwin/amd64/kubectl .
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Linux
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
gcloud compute copy-files \
 | 
					 | 
				
			||||||
  controller0:~/kubernetes/platforms/linux/amd64/kubectl .
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
sudo mv kubectl /usr/local/bin/
 | 
					tar -xvf kubernetes.tar.gz
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### OS X
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					sudo cp kubernetes/platforms/darwin/amd64/kubectl /usr/local/bin
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Linux
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					sudo cp kubernetes/platforms/linux/amd64/kubectl /usr/local/bin
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Configure Kubectl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					kubectl config set-credentials admin --token chAng3m3
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					kubectl config set-cluster kubernetes-the-hard-way \
 | 
				
			||||||
 | 
					  --embed-certs=true \
 | 
				
			||||||
 | 
					  --certificate-authority=ca.pem \
 | 
				
			||||||
 | 
					  --server=https://146.148.34.151:6443
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
gcloud compute http-health-checks create basic-check
 | 
					kubectl config set-context default-context \
 | 
				
			||||||
 | 
					  --cluster=kubernetes-the-hard-way \
 | 
				
			||||||
 | 
					  --user=admin
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
gcloud compute target-pools create kubernetes \
 | 
					kubectl config use-context default-context
 | 
				
			||||||
    --region us-central1 --health-check basic-check
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					At this point you should be able to connect securly to the remote API server:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					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"}  
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					kubectl get nodes
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					NAME      STATUS    AGE
 | 
				
			||||||
 | 
					worker0   Ready     10m
 | 
				
			||||||
 | 
					worker1   Ready     12m
 | 
				
			||||||
 | 
					worker2   Ready     14m
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -587,3 +587,46 @@ etcd-1               Healthy   {"health": "true"}
 | 
				
			|||||||
etcd-0               Healthy   {"health": "true"}   
 | 
					etcd-0               Healthy   {"health": "true"}   
 | 
				
			||||||
etcd-2               Healthy   {"health": "true"}  
 | 
					etcd-2               Healthy   {"health": "true"}  
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Setup Frontend LoadBalancer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					gcloud compute http-health-checks create kube-apiserver-check \
 | 
				
			||||||
 | 
					  --description "Kubernetes API Server Health Check" \
 | 
				
			||||||
 | 
					  --port 8080 \
 | 
				
			||||||
 | 
					  --request-path /healthz
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					gcloud compute target-pools create kubernetes-pool \
 | 
				
			||||||
 | 
					  --region us-central1 \
 | 
				
			||||||
 | 
					  --health-check kube-apiserver-check
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					gcloud compute target-pools add-instances kubernetes-pool \
 | 
				
			||||||
 | 
					  --instances controller0,controller1,controller2 \
 | 
				
			||||||
 | 
					  --zone us-central1-f
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					gcloud compute addresses list
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					NAME        REGION       ADDRESS         STATUS
 | 
				
			||||||
 | 
					kubernetes  us-central1  146.148.34.151  RESERVED
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					gcloud compute forwarding-rules create kubernetes \
 | 
				
			||||||
 | 
					  --region us-central1 \
 | 
				
			||||||
 | 
					  --ports 6443 \
 | 
				
			||||||
 | 
					  --address 146.148.34.151 \
 | 
				
			||||||
 | 
					  --target-pool kubernetes-pool
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					gcloud compute firewall-rules create kubernetes-api-server \
 | 
				
			||||||
 | 
					  --allow tcp:6443
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
		Reference in New Issue
	
	Block a user