Kubernetes- HTTPS API return Unauthorized

+1 vote
When my kubernetes api runs the following command

curl https://192.168.0.139 --cacert /home/mongeo/ku-certs/ca.pem

It throws an error saying “unauthorized”

Request curl localhost:8080 works perfectly fine

How do I get data on https?
Sep 5, 2018 in Kubernetes by Hannah
• 18,540 points
2,706 views

4 answers to this question.

0 votes

Follow these steps:

  1. Find address Server Api - open /etc/kubernetes/kubelet.conf, example : server: https://10.1.32.120:6443
  2. Find token, open /etc/kubernetes/pki/tokens.csv, example : 4c95a1a22d19b20811,kubeadm-node-csr,07ccbf35-e206-11e6-ab8f-0010184e550e,system:kubelet-bootstrap
  3. In this case the token is, 4c95a1a22d19b20811
  4. If use postman, add header,  Authorization: Bearer 4c95a1a22d19b20811

answered Sep 5, 2018 by Kalgi
• 52,360 points
0 votes
Try something like this:

lincai@pdbuddy:~/blackbox$ curl -v --cacert ./ca.pem --key ./admin-key.pem --cert ./admin.pem  https://xxxx/api/v1/

* Hostname was NOT found in DNS cache

>< HTTP/1.1 200 OK
answered Sep 5, 2018 by Nilesh
• 7,060 points
0 votes
Try to specify --token-auth-file=<file> or --basic-auth-file=<otherfile>
answered Sep 5, 2018 by lina
• 8,220 points
0 votes

One way to do this is by creating an SSH tunnel, for example,
ssh -L 9000:localhost:8080 roto@master.node
this will get the connection from your local port tocalhost:8080 on your server. You can query the api on your local port as long as the tunnel is open.

answered Sep 5, 2018 by u_told_me_to

Related Questions In Kubernetes

0 votes
1 answer

Not able to access kubernetes api from a pod in azure

Follow these steps Add --bind-address=0.0.0.0 option to the line https://github.com/kubernetes/kubernetes/blob/v1.2.0/docs/getting-started-guides/coreos/azure/cloud_config_templates/kubernetes-cluster-main-nodes-template.yml#L218  Created ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 52,360 points
986 views
0 votes
3 answers

Request Kubernetes API server

Create a api wrapper. This way you ...READ MORE

answered Aug 31, 2018 in Kubernetes by Hannah
• 18,540 points
1,387 views
0 votes
1 answer

Kubernetes API authentication

Best way to retrieve the token is: kubectl ...READ MORE

answered Sep 3, 2018 in Kubernetes by Kalgi
• 52,360 points
889 views
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,942 views
+2 votes
1 answer
0 votes
2 answers

Access Kubernetes API using minKube

Try these commands: kubectl proxy --port=8080 You can then ...READ MORE

answered Aug 28, 2018 in Kubernetes by Hannah
• 18,540 points
1,841 views
0 votes
2 answers

Access Kubernetes api from within a pod container

wget version: KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token) wget -vO- ...READ MORE

answered Aug 29, 2018 in Kubernetes by Nilesh
• 7,060 points
2,639 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP