connection refused to localhost:8080

5/17/2019

I'm new to kubernetes and not sure what prerequisite I'm missing in order to make it work.

I ran the following command

kubectl create -f k8s-pod.yml 

and the response is

The connection to the server localhost:8080 was refused - did you specify the right host or port?

k8s-pod.yml

apiVersion: v1
kind: Pod

metadata:
  name: app
  labels:
    language: go
    env: test

spec:
  containers:
    - name: app
      image: app:1.0.8
      ports:
        - containerPort: 8080
          protocol: TCP
-- Developer
kubernetes

1 Answer

5/17/2019

can you check if you can connect to kubernetes cluster using the below command

kubectl get cs

if you get an error that means you cant connect to kubernetes api server. check your kubernetes setup

-- P Ekambaram
Source: StackOverflow