How to deploy this app?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 05 2025
0140

To deploy your web application using Kubernetes, follow these steps:

  1. Create a YAML file for the deployment: Create a file named web-app.yaml with 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: 80

    This configuration creates a deployment named web-app in the webapp namespace, running one replica of the NGINX web server.

  2. Apply the deployment: Use the following command to deploy the application to your Kubernetes cluster:

    kubectl apply -f web-app.yaml
  3. Verify the deployment: Check that the web application is running in the webapp namespace with the following command:

    kubectl get pods -n webapp

    You should see the web-app pod listed as running.

If you have any specific requirements or configurations, please let me know!

0 Comments

no data
Be the first to share your comment!