• K8S kubectl命令行常用命令参数


    Operations

    The following table includes short descriptions and the general syntax for all of the kubectl operations:

    OperationSyntaxDescription
    alphakubectl alpha SUBCOMMAND [flags]List the available commands that correspond to alpha features, which are not enabled in Kubernetes clusters by default.
    annotatekubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]Add or update the annotations of one or more resources.
    api-resourceskubectl api-resources [flags]List the API resources that are available.
    api-versionskubectl api-versions [flags]List the API versions that are available.
    applykubectl apply -f FILENAME [flags]Apply a configuration change to a resource from a file or stdin.
    attachkubectl attach POD -c CONTAINER [-i] [-t] [flags]Attach to a running container either to view the output stream or interact with the container (stdin).
    authkubectl auth [flags] [options]Inspect authorization.
    autoscalekubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]Automatically scale the set of pods that are managed by a replication controller.
    certificatekubectl certificate SUBCOMMAND [options]Modify certificate resources.
    cluster-infokubectl cluster-info [flags]Display endpoint information about the master and services in the cluster.
    completionkubectl completion SHELL [options]Output shell completion code for the specified shell (bash or zsh).
    configkubectl config SUBCOMMAND [flags]Modifies kubeconfig files. See the individual subcommands for details.
    convertkubectl convert -f FILENAME [options]Convert config files between different API versions. Both YAML and JSON formats are accepted. Note - requires kubectl-convert plugin to be installed.
    cordonkubectl cordon NODE [options]Mark node as unschedulable.
    cpkubectl cp [options]Copy files and directories to and from containers.
    createkubectl create -f FILENAME [flags]Create one or more resources from a file or stdin.
    deletekubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags]Delete resources either from a file, stdin, or specifying label selectors, names, resource selectors, or resources.
    describekubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags]Display the detailed state of one or more resources.
    diffkubectl diff -f FILENAME [flags]Diff file or stdin against live configuration.
    drainkubectl drain NODE [options]Drain node in preparation for maintenance.
    editkubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags]Edit and update the definition of one or more resources on the server by using the default editor.
    execkubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]Execute a command against a container in a pod.
    explainkubectl explain [--recursive=false] [flags]Get documentation of various resources. For instance pods, nodes, services, etc.
    exposekubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags]Expose a replication controller, service, or pod as a new Kubernetes service.
    getkubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags]List one or more resources.
    kustomizekubectl kustomize [flags] [options]List a set of API resources generated from instructions in a kustomization.yaml file. The argument must be the path to the directory containing the file, or a git repository URL with a path suffix specifying same with respect to the repository root.
    labelkubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]Add or update the labels of one or more resources.
    logskubectl logs POD [-c CONTAINER] [--follow] [flags]Print the logs for a container in a pod.
    optionskubectl optionsList of global command-line options, which apply to all commands.
    patchkubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags]Update one or more fields of a resource by using the strategic merge patch process.
    pluginkubectl plugin [flags] [options]Provides utilities for interacting with plugins.
    port-forwardkubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]Forward one or more local ports to a pod.
    proxykubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]Run a proxy to the Kubernetes API server.
    replacekubectl replace -f FILENAMEReplace a resource from a file or stdin.
    rolloutkubectl rollout SUBCOMMAND [options]Manage the rollout of a resource. Valid resource types include: deployments, daemonsets and statefulsets.
    runkubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server|client|none] [--overrides=inline-json] [flags]Run a specified image on the cluster.
    scalekubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags]Update the size of the specified replication controller.
    setkubectl set SUBCOMMAND [options]Configure application resources.
    taintkubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]Update the taints on one or more nodes.
    topkubectl top [flags] [options]Display Resource (CPU/Memory/Storage) usage.
    uncordonkubectl uncordon NODE [options]Mark node as schedulable.
    versionkubectl version [--client] [flags]Display the Kubernetes version running on the client and server.
    waitkubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options]Experimental: Wait for a specific condition on one or many resources.

    To learn more about command operations, see the kubectl reference documentation.


    参考链接:Command line tool (kubectl) | KubernetesKubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.This tool is named kubectl.For configuration, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.This overview covers kubectl syntax, describes the command operations, and provides common examples. For details about each command, including all the supported flags and subcommands, see the kubectl reference documentation.https://kubernetes.io/docs/reference/kubectl/ 

  • 相关阅读:
    力扣第五十六题——合并区间
    2022.7.26--IDEA(2021.3.1版本,未更新)配置MySQL(5.7.37)JDBC(jar包版本8.0.28)
    寻找第k小的数
    如何在互联网上赚到人生的第一桶金?
    leetcode - 2038. Remove Colored Pieces if Both Neighbors are the Same Color
    set和map使用讲解
    MAX30102心率血氧传感器
    Spring (5)—声明式事务控制
    从事软件开发工作的一些感悟
    南美阿根廷市场最全分析开发攻略,收藏一篇就够了
  • 原文地址:https://blog.csdn.net/a772304419/article/details/126364528