mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 09:18:59 +00:00
1 line
8.7 KiB
JSON
1 line
8.7 KiB
JSON
{"pageProps":{"metadata":{"date":"\"2021-06-13 00:29:49 +08:00\"","date_modified":"\"2021-07-02 16:44:03 +08:00\"","language":"en","source":""},"title":"Command line: kubectl","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"subcommands"},"children":[{"type":"text","value":"Subcommands"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.kubectl#subcommands"},"children":[{"type":"text","value":"Subcommands"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.kubectl#examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"basic-workflow-example-from-a-beginners-perspective"},"children":[{"type":"text","value":"Basic workflow example from a beginner's perspective"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.kubectl#basic-workflow-example-from-a-beginners-perspective"},"children":[{"type":"text","value":"Basic workflow example from a beginner's perspective"}]}]}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The main binary when managing "},{"type":"element","tagName":"a","properties":{"href":"/tools.kubernetes"},"children":[{"type":"text","value":"Kubernetes"}]},{"type":"text","value":" clusters.\n"}]},{"type":"element","tagName":"h1","properties":{"id":"subcommands"},"children":[{"type":"text","value":"Subcommands"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"api-resource"}]},{"type":"text","value":" lists all of the resources it currently supports.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"cluster-info"}]},{"type":"text","value":" prints information of the cluster and the add-ons installed.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"create [RESOURCE] [NAME]"}]},{"type":"text","value":" creates the specified resource with the given name.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"--dry-run"}]},{"type":"text","value":" just initiates the process and does nothing.\n Useful with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-o yaml"}]},{"type":"text","value":" to create a minimal manifest.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-o [yaml|json|wide]"}]},{"type":"text","value":" prints the created resource as the specified output.\n Specially useful to create manifests and manage clusters declaratively.\n"}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"describe [RESOURCE] [NAME]"}]},{"type":"text","value":" prints a detailed description of the given resource.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"logs [RESOURCE] [NAME]"}]},{"type":"text","value":" shows the log printed from the given resource.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"explain [RESOURCE]"}]},{"type":"text","value":" prints an explaination of the given resource — e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"kubectl explain pods"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"kubectl explain rs"}]},{"type":"text","value":".\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"get [RESOURCE]"}]},{"type":"text","value":" list the specified resource from the cluster.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-o, --output [yaml|json|wide]"}]},{"type":"text","value":" prints in the specified format.\n You can also print "},{"type":"element","tagName":"a","properties":{"href":"https://kubernetes.io/docs/reference/kubectl/overview/#custom-columns"},"children":[{"type":"text","value":"the columns"}]},{"type":"text","value":" you only need.\n"}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"apply"}]},{"type":"text","value":" applies a manifest, that is, a configuration file.\n"}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"When referring to a specific resource with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"${RESOURCE}/${NAME}"}]},{"type":"text","value":" — e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"namespace/demo"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"deploy/hello"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"As this is a massive tool, this needs massive examples.\n"}]},{"type":"element","tagName":"h2","properties":{"id":"basic-workflow-example-from-a-beginners-perspective"},"children":[{"type":"text","value":"Basic workflow example from a beginner's perspective"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Say you want to deploy your application with Kubernetes akin to Docker with a single container.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"# Get the description of the cluster.\nkubectl cluster-info\n\n# List all of the supported resources.\nkubectl api-resources\n\n# Create a deployment.\nkubectl create deployment/hello-world --image=alpine\n"}]}]}]},"backlinks":[{"path":"/tools.kubernetes","title":"Kubernetes"}]},"__N_SSG":true} |