A first example of Kubernetes application deployment
After installing our Kubernetes cluster, we will deploy an application in it. First of all, it is important to know that when we deploy an application in Kubernetes, we create a new instance of the Docker container in a Kubernetes pod object, so we first need to have a Docker image that contains the application.
For our example, we will use the Docker image that contains a web application that we have pushed into Docker Hub in Chapter 9, Containerizing Your Application with Docker.
To deploy this instance of the Docker container, we will create a new k8sdeploy
folder, and inside it, we will create a Kubernetes deployment YAML specification file (myapp-deployment.yml
) with the following content:
--- apiVersion: apps/v1 kind: Deployment metadata: name: webapp spec: selector: matchLabels: ...