![]() ![]() Now, let’s use kubectl create to try to create a deployment imperatively, like below # kubectl create deployment testdeploy -image=foxytool Here, we’ve created the deployment named testdeploy, and it is running its two pods. When you run the command kubectl get deployment, you’ll get the following output: NAME READY UP-TO-DATE AVAILABLE AGE If you run the command below, it will create a deployment according to the contents of this manifest file. The name of the deployment manifest file as testdeploy.yaml. Listing 1 below is a manifest file that describes a Kubernetes deployment that has two replicas of our internal tool foxy apiVersion: apps/v1 Let’s explore the details of both kubectl usages. However, if the resource already exists, you will get an error. You can also use kubectl create against a manifest file to create a new instance of the resource. Kubectl create is the command you use to create a Kubernetes resource directly at the command line. Check the infographic from the DigitalOcean for more details. ![]() ![]() The state of the resource is declared in the manifest file, then kubectl apply is used to implement that state. The command set kubectl apply is used at a terminal’s command-line window to create or modify Kubernetes resources defined in a manifest file. What is that? And when we need to use it? In this post, lets discuss about that in detail.īefore starting, the key difference between kubectl apply and create is that apply creates Kubernetes objects through a declarative syntax, while the create command is imperative. With that when we use two of its operations - apply and create - often have confused us. Kubectl is the one of the key tools which help you to perform most of the kubernetes operations like deploy apps, inspect, manage, and troubleshoot. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |