kubectl run starting from 1.18 is creating only Pods and there is no option to
create any other resource. Users should be using kubectl create
commands instead. This update the documentation in all those places
where kubectl create should be used instead or changes description to
reflect the situation.
Proposing fixes for some issues in the page:
1. Handle display issue for the 'kubectl run' command, where pipe character ('|') is not properly escaped, so the text gets trimmed.
Currently the text is rendered like this: "run `kubectl run NAME --image=image [--env=“key=value”] [--port=port] [--replicas=replicas] [--dry-run=server".
The correct text will be displayed like:
"kubectl run NAME --image=image [--env="key=value"] [--port=port] [--replicas=replicas] [--dry-run=server|client|none] [--overrides=inline-json] [flags]".
Also, the description column would be displayed properly.
2. Fixing output of 'get pods' command, when flag --server-print is set to false.
The only displayed columns would be NAME and AGE.
3. Fixing description and sample command for delete pods (kubectl delete pods,service ..), where 'label-name' text is ambiguously used as the label's value. Labels are key-value pairs.
Suggested way of writting it:
"# Delete all the pods and services that have the label '<label-key>=<label-value>'.
kubectl delete pods,services -l <label-key>=<label-value>"
Another way to write it could be:
"# Delete all the pods and services that have the label 'name=<label-value>'.
kubectl delete pods,services -l name=<label-value>"
4. Updating the syntax for three 'kubectl exec' commands, to include the '--' before the user's command, to be inline with current way of working and to avoid deprecation message.
5. Enhance sample for 'kubectl config' command, where the newline was not handled properly.
Before:
[user@wstation ~]$ kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ .context.user }}{{ end }}{{ end }}'
Current user: kubernetes-admin[user@wstation ~]$
After:
[user@wstation ~]$ kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ printf "%s\n" .context.user }}{{ end }}{{ end }}'
Current user: kubernetes-admin
[user@wstation ~]$