![]() You can add YAML files to source control to track changes.While kubectl has a certain simplicity about it, using YAML has two key advantages over running commands manually: This post will explore how to use kubectl, and commands that you may already be familiar with, to generate this YAML.įirst, by way of example, to create a Pod using kubectl you could run the following command: $ kubectl run my-nginx -image nginx -restart NeverĪlternatively, you could write the following YAML in pod.yaml: apiVersion : v1 kind : Pod metadata : name : my-nginx spec : containers : - image : nginx name : my-nginxĪnd, then run: $ kubectl apply -f pod.yamlīoth of these approaches are valid and generate exactly the same result in Kubernetes. ![]() Most often, you provide this information using a YAML file. When you create an object in Kubernetes, including a Deployment, 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 get started with Kubernetes, the first thing you will probably do is create a Deployment using the kubectl command-line interface. Using kubectl to generate Kubernetes YAML
0 Comments
Leave a Reply. |