Skip to content

Instantly share code, notes, and snippets.

@gowatana
Last active December 12, 2020 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/6a9eff5bd29d1febc28b1c2d60c28425 to your computer and use it in GitHub Desktop.
Save gowatana/6a9eff5bd29d1febc28b1c2d60c28425 to your computer and use it in GitHub Desktop.
#!/bin/bash
LOGIN_CONFIG=$1
source $LOGIN_CONFIG
COOKIE=$(curl -k -s -D - \
-X POST \
-H "Content-Type: application/json" \
-u "$PRISM_USER:$PRISM_PASS" \
-d "{}" \
--url "https://$PC_ADDR:9440/api/nutanix/v3/clusters/list" | grep Set-Cookie: | sed "s/^Set-//" | sed "s/\;.*//")
eval curl -k -s \
-X POST \
-H \"Content-Type: application/json\" \
-H \"$COOKIE\" \
-d \'{}\' \
--url "https://$PC_ADDR:9440/karbon/acs/k8s/cluster/list"
@gowatana
Copy link
Author

Nutanix Karbon の Kubernetes クラスタ情報を取得する。

使用方法

下記のようなファイルを用意。

$ cat ./login.txt
PRISM_USER='Prism Central のユーザ'
PRISM_PASS='パスワード'
PC_ADDR='Prism Central のアドレス'

実行。

$ bash ./get_karbon_k8s.sh ./login.txt

@gowatana
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment