To deploy your web application using Kubernetes, follow these steps:
-
Create a YAML file for the deployment: Create a file named
web-app.yamlwith the following content:apiVersion: apps/v1 kind: Deployment metadata: name: web-app namespace: webapp spec: replicas: 1 selector: matchLabels: app: web-app template: metadata: labels: app: web-app spec: containers: - name: nginx image: nginx:latest ports: - containerPort: 80This configuration creates a deployment named
web-appin thewebappnamespace, running one replica of the NGINX web server. -
Apply the deployment: Use the following command to deploy the application to your Kubernetes cluster:
kubectl apply -f web-app.yaml -
Verify the deployment: Check that the web application is running in the
webappnamespace with the following command:kubectl get pods -n webappYou should see the
web-apppod listed as running.
If you have any specific requirements or configurations, please let me know!
