kubectl

Descripción

Mapa Mental sobre kubectl, creado por Luiz Eduardo el 19/03/2022.
Luiz  Eduardo
Mapa Mental por Luiz Eduardo, actualizado hace más de 1 año
Luiz  Eduardo
Creado por Luiz Eduardo hace más de 2 años
327
0

Resumen del Recurso

kubectl

Nota:

  • https://kubernetes.io/docs/reference/kubectl/cheatsheet/https://kubernetes.io/docs/reference/kubectl/ https://kubernetes.io/docs/reference/kubectl/
  1. Useful
    1. kubectl create

      Nota:

      • Run kubectl create to see a list of objects that can be created with imperative commands.
      1. kubectl create deployment my-deployment --image=nginx

        Nota:

        • Create a deployment imperatively.
        1. kubectl create deployment my-deployment --image=nginx --dry-run -o yaml

          Nota:

          • Do a dry run to get some sample yaml without creating the object.
          1. kubectl create deployment my-deployment --image=nginx --dry-run -o yaml > deployment.yml

            Nota:

            • Save the yaml to a file.
            1. kubectl create -f deployment.yml

              Nota:

              • Create the object using the file.
              1. kubectl scale deployment my-deployment replicas=5 --record

                Nota:

                • Scale a deployment and record the command.
                1. kubectl describe deployment my-deployment
                  1. kubectl apply -f FILENAME [flags]
                    1. kubectl drain NODE [options]
                      1. kubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]
                        1. kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]
                          1. kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]
                            1. kubectl expose
                              1. kubectl label
                                1. kubectl logs POD [-c CONTAINER] [--follow] [flags]
                                  1. kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]
                                    1. kubectl uncordon NODE [options]
                                      1. kubectl version [--client] [flags]
                                        1. kubectl api-resources
                                          1. kubectl get pods <pod-name> --server-print=false
                                            1. kubecyl apply
                                              1. kubectl apply -f example-service.yaml

                                                Nota:

                                                • # Create a service using the definition in example-service.yaml.
                                                1. kubectl apply -f example-controller.yaml

                                                  Nota:

                                                  • # Create a replication controller using the definition in example-controller.yaml.
                                                  1. kubectl apply -f <directory>

                                                    Nota:

                                                    • # Create the objects that are defined in any .yaml, .yml, or .json file within the &lt;directory&gt; directory.
                                                  2. kubectl get
                                                    1. kubectl get pods -o wide
                                                      1. kubectl get replicationcontroller <rc-name>

                                                        Nota:

                                                        • # 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'.
                                                        1. kubectl get rc,services

                                                          Nota:

                                                          • # List all replication controllers and services together in plain-text output format.
                                                          1. kubectl get ds

                                                            Nota:

                                                            • # List all daemon sets in plain-text output format.
                                                            1. kubectl get pods --field-selector=spec.nodeName=server01

                                                              Nota:

                                                              • # List all pods running on node server01
                                                              1. kubectl get pods -n kube-system
                                                                1. kubectl get pods -n kube-system --selector k8s-app=calico-node
                                                                  1. kubectl get pv

                                                                    Nota:

                                                                    • kubectl get pv -o yaml&nbsp; _____to get the values and sort them&nbsp; --sort-by=.spec....
                                                                    1. kubectl get pv --sort-by=.spec.capacity.storage
                                                                  2. kubectl config get-contexts
                                                                    1. kubectl config current-context
                                                                      1. kubectl config use-context my-cluster-name
                                                                        1. kubectl config set-context --current --namespace=ggckad-s2
                                                                          1. kubectl config set-context gce --user=cluster-admin --namespace=foo \ && kubectl config use-context gce
                                                                            1. kubectl get pods -n beebox-mobile --kubeconfig /home/cloud_user/dev-k8s-config
                                                                              1. kubectl top po -n beebox-mobile --sort-by=cpu --selector=app=auth > /home/cloud_user/cpu-pod-name.txt
                                                                              2. output systax
                                                                                1. kubectl [command] [TYPE] [NAME] -o <output_format>

                                                                                  Nota:

                                                                                  • 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.
                                                                                  1. Output format
                                                                                    1. -o custom-columns=<spec>

                                                                                      Nota:

                                                                                      • Print a table using a comma separated list of&nbsp;custom columns.
                                                                                      1. kubectl get pods <pod-name> -o custom-columns=NAME:.metadata.name,RSRC:.metadata.resourceVersion
                                                                                      2. -o custom-columns-file=<filename>

                                                                                        Nota:

                                                                                        • Print a table using the&nbsp;custom columns&nbsp;template in the&nbsp;&lt;filename&gt;&nbsp;file.
                                                                                        1. kubectl get pods <pod-name> -o custom-columns-file=template.txt

                                                                                          Nota:

                                                                                          • where the&nbsp;template.txt&nbsp;file contains: NAME RSRC metadata.name metadata.resourceVersion
                                                                                        2. -o json

                                                                                          Nota:

                                                                                          • Output a JSON formatted API object.
                                                                                          1. -o jsonpath=<template>

                                                                                            Nota:

                                                                                            • Print the fields defined in a&nbsp;jsonpath&nbsp;expression.
                                                                                            1. -o jsonpath-file=<filename>
                                                                                              1. -o name
                                                                                                1. -o wide
                                                                                                  1. -o yaml
                                                                                                    1. kubectl get pod web-pod-13je7 -o yaml
                                                                                                2. kubectl get clusterrolebindings
                                                                                                  Mostrar resumen completo Ocultar resumen completo

                                                                                                  Similar

                                                                                                  Italiano - Vocabulario Básico
                                                                                                  maya velasquez
                                                                                                  La Segunda República: Parte 1
                                                                                                  Diego Santos
                                                                                                  Autores y obras de las generación del 98
                                                                                                  maya velasquez
                                                                                                  La acentuación de diptongos, triptongos e hiatos
                                                                                                  Elisa Tormo Guevara
                                                                                                  FACTORIZACION DE POLINOMIOS
                                                                                                  Faber Garcia
                                                                                                  Calendario del curso
                                                                                                  mari.diaz26
                                                                                                  EL ESPAÑOL COMO IDIOMA UNIVERSAL
                                                                                                  RICARDO ALFONSO PEÑA BEJARANO
                                                                                                  HISTORIA: HECHOS, PERSONAJES...
                                                                                                  Ulises Yo
                                                                                                  FGM-12. MANIFESTACIONES EXTERNAS DE LA DISCIPLINA
                                                                                                  antonio del valle
                                                                                                  ÁFRICA
                                                                                                  Ulises Yo
                                                                                                  Mapa Conceptual Resolucion 1995 de 1999
                                                                                                  alsalazar5