stealthkerop.blogg.se

Kubectl create deployment command line
Kubectl create deployment command line




kubectl create deployment command line

You’ll get an output like the following: NAME READY UP-TO-DATE AVAILABLE AGE Let’s run the command set kubectl get deployment to confirm the deployment is indeed running four pods. This means a change has been applied to an existing deployment. The output reports that the deployment has been configured.

KUBECTL CREATE DEPLOYMENT COMMAND LINE UPDATE

To update the deployment from three replicas to five, we can execute following kubectl apply command # kubectl apply -f testdeploy.yaml The number of replicas has been increased from two to five, as shown below in red. We can do this by updating the manifest file, testdeploy.yaml, as shown below. Let’s adjust the first deployment we created: testdeploy. We’ll create it using the following command: # kubectl create deployment testdeploy2 -image=foxytoolĭeployment.apps/testdeploy2 created Change the deployment In this case, we’ll create a Kubernetes deployment named testdeploy2. However, let’s try to execute kubectl create for a resource that doesn’t exist. This is expected right, as we seen before if the resource exists already it throws the error. When you execute the imperative command, you’ll get the following result: Error from server (AlreadyExists): deployments.apps " testdeploy" already exists 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

kubectl create deployment command line

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 deployment command line

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.






Kubectl create deployment command line