Explore the kubectl create Command
The kubectl create command provides multiple subcommands to create Kubernetes resources. It helps manage the creation of resources like namespaces, deployments, services, secrets, and ConfigMaps.
Run the following command to view the available kubectl create subcommands:
kubectl create -h
You will see the following output:
Create a resource from a file or from stdin.
JSON and YAML formats are accepted.
Examples:
## Create a pod using the data in pod.json
kubectl create -f ./pod.json
## Create a pod based on the JSON passed into stdin
cat pod.json | kubectl create -f -
## Edit the data in registry.yaml in JSON then create the resource using the edited data
kubectl create -f registry.yaml --edit -o json
Available Commands:
clusterrole Create a cluster role
clusterrolebinding Create a cluster role binding for a particular cluster role
configmap Create a config map from a local file, directory or literal value
cronjob Create a cron job with the specified name
deployment Create a deployment with the specified name
ingress Create an ingress with the specified name
job Create a job with the specified name
namespace Create a namespace with the specified name
poddisruptionbudget Create a pod disruption budget with the specified name
priorityclass Create a priority class with the specified name
quota Create a quota with the specified name
role Create a role with single rule
rolebinding Create a role binding for a particular role or cluster role
secret Create a secret using specified subcommand
service Create a service using a specified subcommand
serviceaccount Create a service account with the specified name
token Request a service account token
Review the available subcommands and their descriptions to understand how kubectl create can be used.