mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-30 22:57:59 +00:00
b088086b06
Now, it's all under the notebook umbrella. Seems to be appropriate as it is just my notes after all. I also updated some notes from there. I didn't keep track of what it is this time. Something about more learning notes extracted from my "Learning how to learn" course notes and then some. Lack of time and hurriness just makes it difficult to track but it should be under version control already.
2.0 KiB
2.0 KiB
Command line: kubectl
The main binary when managing Kubernetes clusters.
Subcommands
api-resource
lists all of the resources it currently supports.cluster-info
prints information of the cluster and the add-ons installed.-
create [RESOURCE] [NAME]
creates the specified resource with the given name.--dry-run
just initiates the process and does nothing. Useful with-o yaml
to create a minimal manifest.-o [yaml|json|wide]
prints the created resource as the specified output. Specially useful to create manifests and manage clusters declaratively.
describe [RESOURCE] [NAME]
prints a detailed description of the given resource.logs [RESOURCE] [NAME]
shows the log printed from the given resource.explain [RESOURCE]
prints an explaination of the given resource — e.g.,kubectl explain pods
,kubectl explain rs
.-
get [RESOURCE]
list the specified resource from the cluster.-o, --output [yaml|json|wide]
prints in the specified format. You can also print the columns you only need.
apply
applies a manifest, that is, a configuration file.
When referring to a specific resource with ${RESOURCE}/${NAME}
— e.g., namespace/demo
, deploy/hello
.
Examples
As this is a massive tool, this needs massive examples.
Basic workflow example from a beginner's perspective
Say you want to deploy your application with Kubernetes akin to Docker with a single container.
# Get the description of the cluster.
kubectl cluster-info
# List all of the supported resources.
kubectl api-resources
# Create a deployment.
kubectl create deployment/hello-world --image=alpine