0

I applied my react kubernetes manifest file on minikube with the service

I am trying to access it on the browser but I am getting error

This site can’t be reached

deployment.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
  labels:
    app: frontend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      containers:
        - name: frontend
          image: arch-frontend:1.0
          ports:
            - containerPort: 3000
          env:
            - name: REACT_APP_DEV_BASE_URL
              value: backend
          imagePullPolicy: IfNotPresent

serivce.yml

apiVersion: v1
kind: Service
metadata:
  name: frontend
spec:
  selector:
    app: frontend
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
      nodePort: 30012
  externalIPs:
    - 192.168.64.2

I tried to access it on the browser using 192.168.64.2:30012 and 192.168.64.2:3000 but none worked

I did minikube servvice service-name still did not work

etranz
  • 891
  • 2
  • 10
  • 29

1 Answers1

0

In general when you are deploying workloads on a personal computer, there are chances for a firewall to block your application ports from reaching outside. To mitigate this issue you have to check the firewall rules and add them if required.

This official macOS documentation contains information on how to manage firewall rules, go through this documentation and make necessary changes so that you can access your application using the browser.

Also as per the official minikube documentation sometimes Node IP might not be reachable directly in such scenarios you need to create a tunnel for your NodePort service using minikube. Follow the below steps taken from official docs for creating the tunnel using the minikube command:

minikube service (service name) --url