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 image in a cluster pod, so we 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 in the Docker Hub in Chapter 7, Containerizing Your Application with Docker.
To deploy this instance of the Docker image, 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:
app: webapp
replicas: 2
template:
metadata:
labels...