I am trying to host nginx using Kubernetes ReplicationController. Post successful hosting yet it is not reachable via the host system

4/15/2020

replicationcontroller.yml

apiVersion: v1
kind: ReplicationController
metadata:
  name: nginx
spec:
  replicas: 3
  selector:
    app: nginx
  template:
    metadata:
      name: nginx
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80

nginx-service.yml

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  type: NodePort
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80

Commands:

  1. kubectl create -f replicationcontroller.yml
  2. kubectl create -f nginx-service.yml

Kubernetes status Not reachable via host system on port 31078

-- Abhishek
kubernetes
nginx

1 Answer

4/15/2020

I can't reproduce your error; the manifest works for me.

However, if you're using Minikube, you should be aware that Minikube has it's own virtual machine with IP address. Please try:

curl $(minikube ip):31078
-- Sebastiaan
Source: StackOverflow