Trying out a sample deployment

Let's see how we can do the following:

  • Deploy a simple web server based on NGINX in our Kubernetes cluster.
  • Apply some changes to the deployment:
    • Delete a pod and verify that the ReplicaSet creates a new one.
    • Scale the web server to three pods to verify that the ReplicaSet fills the gap.
  • Route external traffic to it using a service with a node port.

First, create a namespace, first-attempts, and update the kubectl context to use this namespace by default:

kubectl create namespace first-attemptskubectl config set-context $(kubectl config current-context) --namespace=first-attempts

We can now create a deployment of NGINX in the namespace using the kubernetes/first-attempts/nginx-deployment.yaml file. This ...

Get Hands-On Microservices with Spring Boot and Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.