tunnel for service target port empty kubernetes and can't access pod from local browser

10/15/2020
apiVersion: apps/v1
kind: Deployment
metadata:
  name: identityold-deployment
spec:
  selector:
    matchLabels:
      app: identityold
  replicas: 1
  template:
    metadata:
      labels:
        app: identityold
    spec:
      containers:
      - name: identityold
        image: <image name from docker hub>
        ports:
        - containerPort: 8081
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: identityold
  name: identityold-svc
  namespace: default
spec:
  type: NodePort  # use LoadBalancer as type here
  ports:
    - port: 80
      targetPort: 8081
      nodePort: 30036
  selector:
    app: identityold

The above code is my deployment YAML file.

enter image description here

and cant access from the browser the service

-- Santhusan Mathivannan
kubernetes

1 Answer

10/15/2020

Exposing a service in minikube cluster is little bit different than in normal kubernetes cluster.

Please follow this guide from kubernetes documentation and use minikube service command in order to expose it properly.

-- Piotr Malec
Source: StackOverflow