How to deploy an app on Minikube?

0248

To deploy an app on Minikube, follow these steps:

  1. Start Minikube:
    First, ensure that Minikube is installed and start it with the following command:

    minikube start
  2. Create a Deployment YAML file:
    Create a YAML file for your application deployment. For example, create a file named app-deployment.yaml:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: my-app
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: my-app
      template:
        metadata:
          labels:
            app: my-app
        spec:
          containers:
          - name: my-app
            image: nginx:latest
            ports:
            - containerPort: 80
  3. Apply the Deployment:
    Use the kubectl apply command to deploy the application:

    kubectl apply -f app-deployment.yaml
  4. Expose the Deployment:
    To access your application, expose it using a service:

    kubectl expose deployment my-app --type=NodePort --port=80
  5. Access the Application:
    Get the URL to access your application:

    minikube service my-app --url
  6. Verify the Deployment:
    Check the status of your deployment:

    kubectl get deployments

By following these steps, you can successfully deploy an application on Minikube.

0 Comments

no data
Be the first to share your comment!