Fix leading spaces in kubectl commands
This is causing bash/zsh shells to not to record the executed command in the history. See this link for details: https://unix.stackexchange.com/questions/115917/why-is-bash-not-storing-commands-that-start-with-spaces Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
committed by
Andrew Chen
parent
0c6bca5b7f
commit
a86d9355b0
@@ -32,11 +32,11 @@ load-balanced access to an application running in a cluster.
|
||||
|
||||
1. Run a Hello World application in your cluster:
|
||||
|
||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||
|
||||
1. List the pods that are running the Hello World application:
|
||||
|
||||
kubectl get pods --selector="run=load-balancer-example"
|
||||
kubectl get pods --selector="run=load-balancer-example"
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
@@ -46,7 +46,7 @@ load-balanced access to an application running in a cluster.
|
||||
|
||||
1. List the replica set for the two Hello World pods:
|
||||
|
||||
kubectl get replicasets --selector="run=load-balancer-example"
|
||||
kubectl get replicasets --selector="run=load-balancer-example"
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
@@ -55,13 +55,13 @@ load-balanced access to an application running in a cluster.
|
||||
|
||||
1. Create a Service object that exposes the replica set:
|
||||
|
||||
kubectl expose rs <your-replica-set-name> --type="LoadBalancer" --name="example-service"
|
||||
kubectl expose rs <your-replica-set-name> --type="LoadBalancer" --name="example-service"
|
||||
|
||||
where `<your-replica-set-name>` is the name of your replica set.
|
||||
|
||||
1. Display the IP addresses for your service:
|
||||
|
||||
kubectl get services example-service
|
||||
kubectl get services example-service
|
||||
|
||||
The output shows the internal IP address and the external IP address of
|
||||
your service. If the external IP address shows as `<pending>`, repeat the
|
||||
@@ -86,8 +86,8 @@ load-balanced access to an application running in a cluster.
|
||||
|
||||
Note: If you are using Minikube, enter these commands:
|
||||
|
||||
kubectl cluster-info
|
||||
kubectl describe services example-service
|
||||
kubectl cluster-info
|
||||
kubectl describe services example-service
|
||||
|
||||
The output displays the IP address of your Minikube node and the NodePort
|
||||
value for your service. Then enter this command to access the Hello World
|
||||
|
||||
@@ -26,7 +26,7 @@ for database debugging.
|
||||
|
||||
1. Create a pod:
|
||||
|
||||
kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/redis-master.yaml
|
||||
kubectl create -f https://k8s.io/docs/tasks/access-application-cluster/redis-master.yaml
|
||||
|
||||
The output of a successful command verifies that the pod was created:
|
||||
|
||||
@@ -34,7 +34,7 @@ for database debugging.
|
||||
|
||||
1. Check to see whether the pod is running and ready:
|
||||
|
||||
kubectl get pods
|
||||
kubectl get pods
|
||||
|
||||
When the pod is ready, the output displays a STATUS of Running:
|
||||
|
||||
@@ -44,7 +44,7 @@ for database debugging.
|
||||
1. Verify that the Redis server is running in the pod and listening on port 6379:
|
||||
|
||||
{% raw %}
|
||||
kubectl get pods redis-master --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}'
|
||||
kubectl get pods redis-master --template='{{(index (index .spec.containers 0).ports 0).containerPort}}{{"\n"}}'
|
||||
{% endraw %}
|
||||
|
||||
The output displays the port:
|
||||
@@ -55,7 +55,7 @@ for database debugging.
|
||||
|
||||
1. Forward port 6379 on the local workstation to port 6379 of redis-master pod:
|
||||
|
||||
kubectl port-forward redis-master 6379:6379
|
||||
kubectl port-forward redis-master 6379:6379
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ provides load balancing for an application that has two running instances.
|
||||
|
||||
1. Run a Hello World application in your cluster:
|
||||
|
||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
|
||||
|
||||
The preceding command creates a
|
||||
[Deployment](/docs/concepts/workloads/controllers/deployment/)
|
||||
@@ -45,21 +45,21 @@ provides load balancing for an application that has two running instances.
|
||||
|
||||
1. Display information about the Deployment:
|
||||
|
||||
kubectl get deployments hello-world
|
||||
kubectl describe deployments hello-world
|
||||
kubectl get deployments hello-world
|
||||
kubectl describe deployments hello-world
|
||||
|
||||
1. Display information about your ReplicaSet objects:
|
||||
|
||||
kubectl get replicasets
|
||||
kubectl describe replicasets
|
||||
kubectl get replicasets
|
||||
kubectl describe replicasets
|
||||
|
||||
1. Create a Service object that exposes the deployment:
|
||||
|
||||
kubectl expose deployment hello-world --type=NodePort --name=example-service
|
||||
kubectl expose deployment hello-world --type=NodePort --name=example-service
|
||||
|
||||
1. Display information about the Service:
|
||||
|
||||
kubectl describe services example-service
|
||||
kubectl describe services example-service
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
@@ -80,7 +80,7 @@ provides load balancing for an application that has two running instances.
|
||||
|
||||
1. List the pods that are running the Hello World application:
|
||||
|
||||
kubectl get pods --selector="run=load-balancer-example" --output=wide
|
||||
kubectl get pods --selector="run=load-balancer-example" --output=wide
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user