Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When you create an object in Kubernetes, you must provide the object spec that describes its desired state, as well as some basic information about the object (such as a name). When you use the Kubernetes API to create the object (either directly or via kubectlvia kubectl), that API request must include that information as JSON in the request body. Most  Most often, you provide the information to kubectl in to kubectl in a .yaml file. kubectl converts  kubectl converts the information to JSON when making the API request.


Here’s an example .yaml file yaml file that shows the required fields and object spec for a Kubernetes Deployment:

...

One way to create a Deployment using a .yaml file yaml file like the one above is to use the kubectl create command in the kubectl commandthe kubectl command-line interface, passing the .yaml file yaml file as an argument. Here’s an example:

$

...

kubectl

...

create

...

-f

...

https://k8s.io/examples/application/deployment.yaml

...

--record

The output is similar to this:

deployment.apps/nginx-deployment

...

created

References

...