Imperative Commands with Kubectl
kuectl create command
kuectl set command
kuectl run command
Other commands
kubectl delete pod POD_NAME --grace-period=0 --force
kubectl annotate (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N
kubectl replace -f FILENAME
kubectl autoscale deployment "deployment name" [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]
This will automatically create HPA object with "deployment name"
kubectl logs --since=DURATION --tail=N --time-stamps=true
kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--type=type]
Here:
TYPE NAME = rc | deploy | pod | svc
type = ClusterIP | NodePort | LoadBalancer
1. kubectl run '--image=image [--env="key=value"] [--port=port] [--labels="key1=value1, key2=value2"] [--requests='cpu=CPU,mem=MEM'] [--serviceaccount=SA] [--command -- COMMAND] [args...]
2. kubectl run '--image=image [--env="key=value"] [--port=port] -- [args...]
3. kubectl run '--image=image [--env="key=value"] [--port=port]
Reference:
https://kubernetes.io/docs/reference/kubectl/conventions/
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
service | type | name | tcp=port:tragetport | node-port |
configmap | fromfile | fromliteral | ||
secret generic | fromfile | fromliteral | ||
rolebinding | clusterrole | serviceaccount | role | |
clusterrolebinding | clusterrole | serviceaccount | ||
role | verb | resource | ||
clusterrole | verb | resource | ||
cronjob | image | schedule | ||
deployment | image | |||
job | image | from=cj name |
kuectl set command
env | RESOURCE/NAME | KEY_1=VAL_1 ... KEY_N=VAL_N |
image | (-f FILENAME | TYPE NAME) | container=image |
resources | (-f FILENAME | TYPE NAME) | ([--limits=cpu=CPU,mem=MEM & --requests=REQUESTS] |
sa | (-f FILENAME | TYPE NAME) | SA_NAME |
kuectl run command
run | --restart==OnFailure --schedule="* * * * *" | Job |
--restart=Never | pod | |
--generator=run-pod/v1 | pod |
Other commands
kubectl delete pod POD_NAME --grace-period=0 --force
kubectl annotate (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N
kubectl replace -f FILENAME
kubectl autoscale deployment "deployment name" [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]
This will automatically create HPA object with "deployment name"
kubectl logs --since=DURATION --tail=N --time-stamps=true
kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--type=type]
Here:
TYPE NAME = rc | deploy | pod | svc
type = ClusterIP | NodePort | LoadBalancer
1. kubectl run '--image=image [--env="key=value"] [--port=port] [--labels="key1=value1, key2=value2"] [--requests='cpu=CPU,mem=MEM'] [--serviceaccount=SA] [--command -- COMMAND] [args...]
2. kubectl run '--image=image [--env="key=value"] [--port=port] -- [args...]
3. kubectl run '--image=image [--env="key=value"] [--port=port]
Reference:
https://kubernetes.io/docs/reference/kubectl/conventions/
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
0 comments:
Post a Comment