O'Reilly logo

Docker and Kubernetes for Java Developers by Jaroslaw Krochmalski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a deployment using the API

Creating a deployment is very similar to creating a service, it's creating another type of Kubernetes resource, after all. All we need is a proper JSON payload file that we will be sending to the api-server using the POST HTTP method. Our rest-example deployment manifest in JSON can look as follows:

{  "apiVersion": "extensions/v1beta1",  "kind": "Deployment",  "metadata": {    "name": "rest-example"  },  "spec": {    "replicas": 1,    "template": {      "metadata": {        "labels": {          "app": "rest-example",          "tier": "backend"        }      },      "spec": {        "containers": [          {            "name": "rest-example",            "image": "jotka/rest-example",            "imagePullPolicy": "IfNotPresent",            "resources": {              "requests": {                "cpu": "100m",                "memory": "100Mi"              }            },            "env": [              { "name": ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required