Karbon API Deployment - Autentification Error | Nutanix Community
Skip to main content

Hi all, 

I tried to deploy a Karbon Development Cluster by using Karbon API, but I encounter an error with authentication.   

{"message_list":{"Unauthorized":"Failed to get authentication info"},"status_code":401}

The command for calling Karbon API is : 

curl -k -X POST -d @create-cluster-dev.json --header "Content-Type: application/json" --header "Accept: application/json" --user $NUTANIX_USER:$NUTANIX_USER_PASS "https://xxx.xxx.xxx.xxx:9440/karbon/acs/k8s/cluster"

 

When I try to use other Prism API command, like cluster or vm with these command below,, everything works fine, so I don’t think that my login/password are wrong. I haven’t seen much more into nutanix log file, but maybe i’m looking at the wrong place (/data/logs). 

curl -k -X POST -d @nutanix-list-cluster.json --header "Content-Type: application/json" --header "Accept: application/json" --user $NUTANIX_USER:$NUTANIX_USER_PASS "https://xxx.xxx.xxx.xxx:9440/api/nutanix/v3/clusters/list"

 

Has anyone encountered this error before ?

Hi @MVerhaeghe , can you go to location ~/data/logs/ on the PC-VM and check the logs inside karbon_core.out at the above location. This log is the primary place to look for any Karbon deployment issues. Also is your PC environment using any Proxy ?, If that is the case, can you once check out this KB article KB 7230(Special Consideration deploying Karbon in a proxy environment)


Hi @MVerhaeghe , were you able to solve the issue. Did the error go? 

Did the above documents help?


Hi Anish, 

Thanks for your reply, I haven’t resolve the issue yet. I’ve read the document that you’ve pointed and I think that maybe my proxy may be the problem, cause I need to pass autentication to it, and for what I’ve read, it’s a problem with Karbon deployment. The thing is that I’m not certain that I can avoid it. I’m working with my team on this point for now. 

 

PS : The karbon_core log file in the directory data/logs is not very helpful, the only message print is  :  

2020/06/15 09:45:13.463794 common_handler.go:145: mERROR] Error type: Unauthorized, code: 401, message: Failed to get authentication info

 


Hi @MVerhaeghe , I see. Thanks for the update. Yes, true even I was suspecting it has got to do something with the proxy. Sure, that sounds good. Also, you can always go ahead and open a support case for such issues. :relaxed:

Ya, even the logs shows the same error message. These are the primary logs for troubleshooting Karbon deployment issues.

 

Let me know if you need anything else.

 


Hi,

I finally resolved the authentication error.

The solution was to authenticate a first time to the Prism Central API, and store the cookie session into a variable. Then you can call the Karbon API with adding the cookie to the request, and Voila !

I rewrite my code to make the call with ansible, and it’s working. I have some additionnals errors (NTP servers are not properly set, but there are note tied to the authentication and we are currently fixing it).

 

For information, here’s my code for ansible call :
 

- name: Check that you can connect (GET) to Nutanix API with your identification
uri:
url: "https://{{ prism_central_api_url }}:{{ prism_central_api_port }}/api/nutanix/v3/clusters/list"
user: "{{ prism_central_user }}"
password: "{{ prism_central_password }}"
method: "POST"
body: "{{ lookup('file', 'nutanix-list-cluster.json') }}"
body_format: json
force_basic_auth: yes
validate_certs: no
return_content: yes
status_code: 200
register: login

- name: Set fact for Session Cookie
set_fact:
session_cookie: "{{ login.set_cookie }}"

- name: Calling Karbon API for bring up the new dev cluster
uri:
url: "https://{{ prism_central_api_url }}:{{ prism_central_api_port }}/karbon/acs/k8s/cluster"
user: "{{ prism_central_user }}"
password: "{{ prism_central_password }}"
method: "POST"
body: "{{ lookup('file','create-cluster-dev.json') }}"
body_format: json
force_basic_auth: yes
return_content: yes
status_code: 200
validate_certs: no
headers:
Cookie: "{{ login.set_cookie }}"
register: karbon_response

 

Thanks again @AnishWalia20 for your time and assistance. :)

 


Hey @MVerhaeghe , that sounds amazing. Really glad to hear that.  Thanks for sharing the solution too it would help others who will be facing similar issues.:smile:

 

And regarding the NTP issues maybe this KB article http://portal.nutanix.com/kb/4519 can help as this has good amount of information to troubleshoot NTP issues and some best practices etc.

It is indeed always a pleasure to help.:smile: