1. Install Minikube: Begin by installing Minikube, a tool for running Kubernetes clusters locally. You can find installation instructions here.

  2. Start Minikube: Launch your Minikube cluster with the simple command minikube start.

  3. Enable Ingress Addon: Before deploying your application, make sure the Ingress addon is enabled using minikube addons enable ingress.

  4. Create Deployment YAML File: Prepare a deployment.yml file with the following YAML content. This file specifies your application’s deployment, service, and ingress settings.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx-echo
        image: ealen/echo-server:latest
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
spec:
  rules:
    - host: local.minikube.com
      http:
        paths:
          - path: /test
            pathType: Prefix
            backend:
              service:
                name: nginx-service
                port:
                  number: 80
  1. Deploy the Service: Execute the deployment using the command minikube kubectl apply -f deployment.yml

  2. Check Cluster Status: To inspect the status of your cluster, run minikube kubectl get all. This command provides information about pods, services, and deployments.

    Output:

    > kubectl get all                                 
    
    NAME                                    READY   STATUS    RESTARTS   AGE          
    pod/nginx-deployment-69fccd8878-js6hw   1/1     Running   0          2m43s        
    pod/nginx-deployment-69fccd8878-t8tmk   1/1     Running   0          2m43s        
    
    NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)   AGE  
    service/kubernetes      ClusterIP   10.96.0.1        <none>        443/TCP   3h7m 
    service/nginx-service   ClusterIP   10.101.252.146   <none>        80/TCP    2m19s
    
    NAME                               READY   UP-TO-DATE   AVAILABLE   AGE           
    deployment.apps/nginx-deployment   2/2     2            2           2m43s         
    
    NAME                                          DESIRED   CURRENT   READY   AGE     
    replicaset.apps/nginx-deployment-69fccd8878   2         2         2       2m43s   
    
  3. Update Hosts File: Add the IP address obtained from minikube ip to your local machine’s hosts file with the entry <minikube-ip> local.minikube.com.

  4. Access the Exposed Endpoint: Verify the exposed endpoint either through your web browser or the terminal using curl local.minikube.com/test.

    Output:

    > curl local.minikube.com/test -LI
    
    HTTP/1.1 200 OK
    Date: Thu, 09 Nov 2023 10:05:54 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 1312
    Connection: keep-alive
    ETag: W/"520-0/1/+RNXhJAhsdHmMK7KxLuAlic"
    

By following these steps, you can set up Minikube, deploy your application, and access it via an Ingress controller while preserving all the provided files and output.