Join us for a virtual Nutanix User Group meeting with Jarian Gibson as he covers Nutanix Cloud Clusters (NC2) on Azure and AWS with Citrix. <\/span><\/p>

Jarian will take a deep dive into NC2 on Azure architecture and Citrix on NC2 on Azure\u00a0that helps you strengthen your business continuity and disaster recovery position. He\u2019ll also provide the latest updates for NC2 on AWS.<\/span><\/p>

Plus, we're\u00a0giving away a Nutanix suitcase to one lucky winner!\u00a0Opt-in when you register\u00a0to be entered to win.\u00a0<\/p>","author":{"id":113632,"url":"\/members\/karlie-beil-113632","name":"Karlie Beil","avatar":"https:\/\/uploads-us-west-2.insided.com\/nutanix-us\/icon\/200x200\/1581aab3-bcf6-49f4-b2fb-3d11e8c010dc.png","userTitle":"Community Manager","rank":{"isBold":false,"isItalic":false,"isUnderline":false,"name":"Community Manager","color":"#0873ba"},"userLevel":4},"type":"Webinar","url":"https:\/\/next.nutanix.com\/events\/global-nug-nc2-on-azure-and-aws-with-citrix-151","image":"https:\/\/uploads-us-west-2.insided.com\/nutanix-us\/attachment\/f9693b5b-436b-427a-9b98-531b4040ff24_thumb.png","location":"","startsAt":1678298400,"endsAt":1678302000,"contentType":"event","attendees":[],"attendeeCount":0,"isLoggedInUserAttendee":false,"createdAt":"1675974969"},"phrases":{"Forum":{"{n} year|{n} years":"{n} year|{n} years","{n} month|{n} months":"{n} month|{n} months","{n} day|{n} days":"{n} day|{n} days","{n} hour|{n} hours":"{n} hour|{n} hours","{n} minute|{n} minutes":"{n} minute|{n} minutes","just":"just now","{plural} ago":"{plural} ago"}}}">

解决了

Karbon API部署 - 自动化错误


大家好,

我尝试通过使用Karbon API来部署Karbon开发集群,但是我遇到了身份验证的错误。

{“ message_list”:{“未经授权”:“无法获得身份验证信息”},“ status_code”:401}

调用Karbon API的命令是:

curl -k -x post -d @create -cluster -dev.json -header“ content -type:application/json” - -header“ convect:application/json” -user $ nutanix_user:$ nutanix_user_pass“ https:/https:/https:/https://xxx.xxx.xxx.xxx:9440/karbon/acs/k8s/cluster“

当我尝试使用其他prism API命令(例如cluster或vm)在下面的这些命令中,一切正常,所以我认为我的登录/密码不会错。我还没有看到更多的Nutanix日志文件,但也许我正在寻找错误的位置(/DATA/LOGS)。

curl -k -x post -d @nutanix-list -cluster.json--header“ content -type:application/json” - -header“ convect:application/json” -user $ nutanix_user:$ nutanix_user_pass_pass“ https” https:/https:/https://xxx.xxx.xxx.xxx:9440/api/nutanix/v3/clusters/list“

以前有人遇到过这个错误吗?

图标

最好的答案梅弗海格2020年6月25日,12:24

Hi,<\/p>

I finally resolved the authentication error.<\/p>

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 !<\/p>

I rewrite my code to make the call with ansible, and it\u2019s 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).<\/p>

\u00a0<\/p>

For information, here\u2019s my code for ansible call :
\u00a0<\/p>

- 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<\/code><\/pre>

\u00a0<\/p>

Thanks again @AnishWalia20<\/user-mention> for your time and assistance. :)<\/p>

\u00a0<\/p>","className":"post__content__best_answer"}">

查看原件

该主题已关闭以供评论

6个答复

UserLevel 6
徽章 +5

你好 @mverhaeghe,你能去地点〜/数据/日志/在PC-VM上并检查内部的日志karbon_core.out在上面的位置。该日志是寻找任何Karbon部署问题的主要场所。您的PC环境是否使用任何代理?KB 7230(特殊考虑在代理环境中部署Karbon)

UserLevel 6
徽章 +5

你好 @mverhaeghe,您能解决这个问题吗?错误发生了吗?

以上文件有帮助吗?

嗨,阿尼什,

感谢您的答复,我还没有解决这个问题。我已经阅读了您所指出的文档,我认为也许我的代理可能是问题所在,因为我需要对其进行自动处理,而对于我阅读的内容,这是Karbon部署的问题。问题是我不确定自己可以避免它。目前,我正在与团队合作。

PS:目录数据/日志中的Karbon_core日志文件不是很有帮助,唯一的消息打印是:

2020/06/15 09:45:13.463794 common_handler.go:145:[错误]错误类型:未经授权,代码:401,消息:无法获得身份验证信息

UserLevel 6
徽章 +5

你好 @mverhaeghe, 我懂了。感谢更新。是的,是的,即使我怀疑它必须对代理人做些事情。当然,这听起来不错。另外,您随时可以继续为此类问题打开支持案例。:轻松:

是的,即使日志也显示相同的错误消息。这些是用于解决karbon部署问题的主要日志。

需要帮助请叫我。

你好,

我终于解决了身份验证错误。

解决方案是对Prism Central API的第一次验证,并将Cookie会话存储到变量中。然后,您可以将cookie添加到请求中,然后瞧瞧!

我重写代码以用Ansible拨打电话,并且可以正常工作。我有一些添加性错误(NTP服务器无法正确设置,但是与身份验证有关,我们目前正在修复它)。

有关信息,以下是我的Ansible Call代码:

- 名称:检查您可以使用身份证明连接(获取)到Nutanix API
URI:
url:“ https:// {{prism_central_api_url}}}:{{prism_central_api_port}}/api/api/nutanix/v3/clusters/list/list/list'
用户:“ {{{prism_central_user}}”
密码:“ {{prism_central_password}}”
方法:“邮寄”
身体:“ {{lookup('file','nutanix-list-cluster.json')}}}”
Body_Format:JSON
force_basic_auth:是的
validate_certs:否
return_content:是的
status_code:200
注册:登录

- 名称:设置会话cookie的事实
set_fact:
session_cookie:“ {{{login.set_cookie}}”

- 名称:致电Karbon API提出新的开发群集
URI:
url:“ https:// {{prism_central_api_url}}}:{{prism_central_api_port}}}/karbon/acs/acs/k8s/cluster“
用户:“ {{{prism_central_user}}”
密码:“ {{prism_central_password}}”
方法:“邮寄”
身体:“ {{lookup('file','create-cluster-dev.json')}}}”
Body_Format:JSON
force_basic_auth:是的
return_content:是的
status_code:200
validate_certs:否
标题:
cookie:“ {{{login.set_cookie}}”
注册:Karbon_Response

再次感谢 @anishwalia20为您的时间和帮助。:)

UserLevel 6
徽章 +5

@mverhaeghe,听起来很棒。真的很高兴听到这个消息。也感谢您分享解决方案,它将帮助将面临类似问题的其他人。:微笑:

关于NTP问题,也许这本KB文章http://portal.nutanix.com/kb/4519可以提供帮助,因为这有大量信息来解决NTP问题和一些最佳实践等。

确实总是很高兴提供帮助。:微笑:

Learn more about our cookies.<\/a>","cookiepolicy.button":"Accept cookies","cookiepolicy.button.deny":"Deny all","cookiepolicy.link":"Cookie settings","cookiepolicy.modal.title":"Cookie settings","cookiepolicy.modal.content":"We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.<\/a>","cookiepolicy.modal.level1":"Basic
Functional","cookiepolicy.modal.level2":"Normal
Functional + analytics","cookiepolicy.modal.level3":"Complete
Functional + analytics + social media + embedded videos"}}}">
Baidu