简体   繁体   中英

Kubectl Error when accessing Namespaces

I was trying out the Tectonic Kubernetes sandbox setup and according to their documentation:

https://coreos.com/tectonic/docs/latest/tutorials/first-app.html

I did download the kubectl and the corresponding kube-config files, but when I tried to get the namespaces using the following command:

kubectl get namespaces

I get the following error:

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

What is this? From where is it picking up this port locahost:8080?

EDIT:

Joe-MacBook-Pro:~ joe$ kubectl config get-contexts
CURRENT   NAME      CLUSTER   AUTHINFO   NAMESPACE
Joe-MacBook-Pro:~ joe$

I'm lacking some details on your setup, but the problem is basically clear - you're not connected to the cluster.

You should have a kubeconfig file containing the cluster connection information ie the context, I assume if you run kubectl config view you'll get nothing.

I'm on windows using git bash, if I run the same command I get:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://platform-svc-integration.net
  name: svc-integration
contexts:
- context:
    cluster: svc-integration
    user: svc-integration-admin
  name: svc-integration-system
current-context: svc-integration-system
kind: Config
preferences: {}
users:
- name: svc-integration-admin
  user:
    client-certificate: <path>/admin/admin.crt
    client-key: <path>/admin/admin.key

basically what I'm trying to say is you need to configure your context, start by doing kubectl config --help to list your options, it's pretty straight forward but if don't manage just refer to the documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM