Creating a Deployment
POST {{kube-api-server}}/apis/apps/v1/namespaces/default/deployments?fieldManager=kubectl-client-side-apply
Deployment
In the previous section, we created a pod and deleted it. That means our app is no longer running. In a real world scenario though, we would want to have multiple instances of our app running so that the requests could be load balanced across them. We want to ensure that at least a minimum amount of instances are running. Deployments can help us manage it all.

Inside the request body, we have the configuration for the deployment.
Replicas: Refer to the number of pods that should be running for a deployment. We are assigning the pods that get created via this deployment a label of -pod, based on the details in the spec, the pods will be created.
Labels: Pods are matched to the respective deployments by these labels.The body also contains a definition for a readiness probe and a liveness probe.
Readiness Probe: Based on the readiness probe containers are assigned traffic in Kubernetes. This can be used when the container is not ready to serve traffic due to other services it depends on, or if it is loading any data/configuration.
Liveness probe: It is a check based on which the containers restart. So to check if the dobby app is up, the /health endpoint will be hit, if it returns a 500 then the containers are restarted.
Press Send to create a deployment and look into the Visualization tab for the next steps.

Request Params
Key | Datatype | Required | Description |
---|---|---|---|
fieldManager | string |
Request Body
{"apiVersion"=>"apps/v1", "kind"=>"Deployment", "metadata"=>{"name"=>"{{project-name}}-deployment", "labels"=>{"app"=>"{{project-name}}-pod"}}, "spec"=>{"replicas"=>2, "selector"=>{"matchLabels"=>{"app"=>"{{project-name}}-pod"}}, "template"=>{"metadata"=>{"labels"=>{"app"=>"{{project-name}}-pod"}}, "spec"=>{"containers"=>[{"name"=>"{{project-name}}-container", "image"=>"thecasualcoder/dobby", "env"=>[{"name"=>"VERSION", "value"=>"2.0"}, {"name"=>"INITIAL_DELAY", "value"=>"0"}, {"name"=>"INITIAL_HEALTH", "value"=>"TRUE"}, {"name"=>"INITIAL_READINESS", "value"=>"TRUE"}], "ports"=>[{"containerPort"=>4444}], "readinessProbe"=>{"httpGet"=>{"path"=>"/readiness", "port"=>4444}, "initialDelaySeconds"=>20, "periodSeconds"=>3}, "livenessProbe"=>{"httpGet"=>{"path"=>"/health", "port"=>4444}, "initialDelaySeconds"=>20, "periodSeconds"=>3}}]}}}}