0

I am trying to connect to my kubernetes cluster which was spunup using kubeadm on aws instances.

I am using lens desktop app on windows.

My kubeconfig file

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://<private ip address of the master>:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: DATA+OMITTED
    client-key-data: DATA+OMITTED

i think the issue is with private ip address as server. kindly help me with this error

E0607 15:01:56.696813 3604 proxy_server.go:147] Error while proxying request: dial tcp :6443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Failed to get /version for clusterId=: Internal Server Error

If i change the config file and add public ip address there i am getting another error

E0607 16:25:02.787250 484 proxy_server.go:147] Error while proxying request: tls: failed to verify certificate: x509: certificate is valid certificate is valid for privateip1, privateip2, not publicip of the master

Failed to get /version for clusterId=clusterid: Internal Server Error

1 Answer 1

0

I changed my admin.conf file, removed the certificate and added public ip address of the master and then added insecure-skip-tsl-verify: true flag and then it worked.

apiVersion: v1
clusters:
- cluster:
    server: https://masterPublicIP:6443
    insecure-skip-tls-verify: true
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: DATA+OMITTED
    client-key-data: DATA+OMITTED

This solved my issue temporarily. I will update the answer if I find permanent solution

2
  • Sounds like you turned off a lot of security there - probably not recommended!
    – shearn89
    Commented Jun 20 at 8:15
  • @shearn89 i am asking for the solution. Since this is testing it is okay for now. But I cant use it my production. Why does master api server is the private ip. how can i make it use public ip Commented Jun 21 at 9:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .