Mapa mental
kubectl

Mind map: kubectl commands
Contenido del mapa
kubectl
- https://kubernetes.io/docs/reference/kubectl/cheatsheet/https://kubernetes.io/docs/reference/kubectl/ https://kubernetes.io/docs/reference/kubectl/
Useful
- kubectl create
- Run kubectl create to see a list of objects that can be created with imperative commands.
- kubectl create deployment my-deployment --image=nginx
- Create a deployment imperatively.
- kubectl create deployment my-deployment --image=nginx --dry-run -o yaml
- Do a dry run to get some sample yaml without creating the object.
- kubectl create deployment my-deployment --image=nginx --dry-run -o yaml > deployment.yml
- Save the yaml to a file.
- kubectl create -f deployment.yml
- Create the object using the file.
- kubectl scale deployment my-deployment replicas=5 --record
- Scale a deployment and record the command.
- kubectl describe deployment my-deployment
- kubectl apply -f FILENAME [flags]
- kubectl drain NODE [options]
- kubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]
- kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]
- kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]
- kubectl expose
- kubectl label
- kubectl logs POD [-c CONTAINER] [--follow] [flags]
- kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]
- kubectl uncordon NODE [options]
- kubectl version [--client] [flags]
- kubectl api-resources
- kubectl get pods <pod-name> --server-print=false
- kubecyl apply
- kubectl apply -f example-service.yaml
- # Create a service using the definition in example-service.yaml.
- kubectl apply -f example-controller.yaml
- # Create a replication controller using the definition in example-controller.yaml.
- kubectl apply -f <directory>
- # Create the objects that are defined in any .yaml, .yml, or .json file within the <directory> directory.
- kubectl apply -f example-service.yaml
- kubectl get
- kubectl get pods -o wide
- kubectl get replicationcontroller <rc-name>
- # List the replication controller with the specified name in plain-text output format. Tip: You can shorten and replace the 'replicationcontroller' resource type with the alias 'rc'.
- kubectl get rc,services
- # List all replication controllers and services together in plain-text output format.
- kubectl get ds
- # List all daemon sets in plain-text output format.
- kubectl get pods --field-selector=spec.nodeName=server01
- # List all pods running on node server01
- kubectl get pods -n kube-system
- kubectl get pods -n kube-system --selector k8s-app=calico-node
- kubectl get pv
- kubectl get pv -o yaml _____to get the values and sort them --sort-by=.spec....
- kubectl get pv --sort-by=.spec.capacity.storage
- kubectl config get-contexts
- kubectl config current-context
- kubectl config use-context my-cluster-name
- kubectl config set-context --current --namespace=ggckad-s2
- kubectl config set-context gce --user=cluster-admin --namespace=foo \ && kubectl config use-context gce
- kubectl get pods -n beebox-mobile --kubeconfig /home/cloud_user/dev-k8s-config
- kubectl top po -n beebox-mobile --sort-by=cpu --selector=app=auth > /home/cloud_user/cpu-pod-name.txt
- kubectl create
output systax
- kubectl [command] [TYPE] [NAME] -o <output_format>
- The default output format for all kubectl commands is the human readable plain-text format. To output details to your terminal window in a specific format, you can add either the -o or --output flags to a supported kubectl command.
- Output format
- -o custom-columns=<spec>
- Print a table using a comma separated list of custom columns.
- kubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion
- -o custom-columns-file=<filename>
- Print a table using the custom columns template in the <filename> file.
- kubectl get pods <pod-name> -o custom-columns-file=template.txt
- where the template.txt file contains: NAME RSRC metadata.name metadata.resourceVersion
- -o json
- Output a JSON formatted API object.
- -o jsonpath=<template>
- Print the fields defined in a jsonpath expression.
- -o jsonpath-file=<filename>
- -o name
- -o wide
- -o yaml
- kubectl get pod web-pod-13je7 -o yaml
- -o custom-columns=<spec>
- kubectl [command] [TYPE] [NAME] -o <output_format>
kubectl get clusterrolebindings
Información
- Descripción
- Mapa Mental sobre kubectl, creado por Luiz Eduardo el 19/03/2022.
- Creado por
- Luiz Eduardo
- Visitas
- 393
- Valoración