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
@@ -39,11 +39,11 @@ file for the Pod defines a command and two arguments:
|
||||
|
||||
1. Create a Pod based on the YAML configuration file:
|
||||
|
||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/commands.yaml
|
||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/commands.yaml
|
||||
|
||||
1. List the running Pods:
|
||||
|
||||
kubectl get pods
|
||||
kubectl get pods
|
||||
|
||||
The output shows that the container that ran in the command-demo Pod has
|
||||
completed.
|
||||
@@ -51,7 +51,7 @@ file for the Pod defines a command and two arguments:
|
||||
1. To see the output of the command that ran in the container, view the logs
|
||||
from the Pod:
|
||||
|
||||
kubectl logs command-demo
|
||||
kubectl logs command-demo
|
||||
|
||||
The output shows the values of the HOSTNAME and KUBERNETES_PORT environment
|
||||
variables:
|
||||
|
||||
@@ -34,11 +34,11 @@ Pod:
|
||||
|
||||
1. Create a Pod based on the YAML configuration file:
|
||||
|
||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/envars.yaml
|
||||
kubectl create -f https://k8s.io/docs/tasks/inject-data-application/envars.yaml
|
||||
|
||||
1. List the running Pods:
|
||||
|
||||
kubectl get pods -l purpose=demonstrate-envars
|
||||
kubectl get pods -l purpose=demonstrate-envars
|
||||
|
||||
The output is similar to this:
|
||||
|
||||
@@ -47,7 +47,7 @@ Pod:
|
||||
|
||||
1. Get a shell to the container running in your Pod:
|
||||
|
||||
kubectl exec -it envar-demo -- /bin/bash
|
||||
kubectl exec -it envar-demo -- /bin/bash
|
||||
|
||||
1. In your shell, run the `printenv` command to list the environment variables.
|
||||
|
||||
|
||||
@@ -37,16 +37,16 @@ username and password:
|
||||
|
||||
1. Create the Secret
|
||||
|
||||
kubectl create -f secret.yaml
|
||||
kubectl create -f secret.yaml
|
||||
|
||||
**Note:** If you want to skip the Base64 encoding step, you can create a Secret
|
||||
by using the `kubectl create secret` command:
|
||||
|
||||
kubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'
|
||||
kubectl create secret generic test-secret --from-literal=username='my-app' --from-literal=password='39528$vdg7Jb'
|
||||
|
||||
1. View information about the Secret:
|
||||
|
||||
kubectl get secret test-secret
|
||||
kubectl get secret test-secret
|
||||
|
||||
Output:
|
||||
|
||||
@@ -56,7 +56,7 @@ username and password:
|
||||
|
||||
1. View more detailed information about the Secret:
|
||||
|
||||
kubectl describe secret test-secret
|
||||
kubectl describe secret test-secret
|
||||
|
||||
Output:
|
||||
|
||||
@@ -80,11 +80,11 @@ Here is a configuration file you can use to create a Pod:
|
||||
|
||||
1. Create the Pod:
|
||||
|
||||
kubectl create -f secret-pod.yaml
|
||||
kubectl create -f secret-pod.yaml
|
||||
|
||||
1. Verify that your Pod is running:
|
||||
|
||||
kubectl get pod secret-test-pod
|
||||
kubectl get pod secret-test-pod
|
||||
|
||||
Output:
|
||||
|
||||
@@ -94,7 +94,7 @@ Here is a configuration file you can use to create a Pod:
|
||||
|
||||
1. Get a shell into the Container that is running in your Pod:
|
||||
|
||||
kubectl exec -it secret-test-pod -- /bin/bash
|
||||
kubectl exec -it secret-test-pod -- /bin/bash
|
||||
|
||||
1. The secret data is exposed to the Container through a Volume mounted under
|
||||
`/etc/secret-volume`. In your shell, go to the directory where the secret data
|
||||
@@ -127,11 +127,11 @@ Here is a configuration file you can use to create a Pod:
|
||||
|
||||
1. Create the Pod:
|
||||
|
||||
kubectl create -f secret-envars-pod.yaml
|
||||
kubectl create -f secret-envars-pod.yaml
|
||||
|
||||
1. Verify that your Pod is running:
|
||||
|
||||
kubectl get pod secret-envars-test-pod
|
||||
kubectl get pod secret-envars-test-pod
|
||||
|
||||
Output:
|
||||
|
||||
@@ -140,7 +140,7 @@ Here is a configuration file you can use to create a Pod:
|
||||
|
||||
1. Get a shell into the Container that is running in your Pod:
|
||||
|
||||
kubectl exec -it secret-envars-test-pod -- /bin/bash
|
||||
kubectl exec -it secret-envars-test-pod -- /bin/bash
|
||||
|
||||
1. In your shell, display the environment variables:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user