¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

kubectl

Luiz Eduardo Portugués

Mind map of kubectl commands: useful commands, output syntax and kubectl get clusterrolebindings

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/
  1. 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 &lt;directory&gt; directory.
    • 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&nbsp; _____to get the values and sort them&nbsp; --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
  2. output systax

    • kubectl [command] [TYPE] [NAME] -o <output_format>
      • The default output format for all&nbsp;kubectl&nbsp;commands is the human readable plain-text format. To output details to your terminal window in a specific format, you can add either the&nbsp;-o&nbsp;or&nbsp;--output&nbsp;flags to a supported&nbsp;kubectl&nbsp;command.
    • Output format
      • -o custom-columns=<spec>
        • Print a table using a comma separated list of&nbsp;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&nbsp;custom columns&nbsp;template in the&nbsp;&lt;filename&gt;&nbsp;file.
        • kubectl get pods <pod-name> -o custom-columns-file=template.txt
          • where the&nbsp;template.txt&nbsp;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&nbsp;jsonpath&nbsp;expression.
      • -o jsonpath-file=<filename>
      • -o name
      • -o wide
      • -o yaml
        • kubectl get pod web-pod-13je7 -o yaml
  3. 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

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?