如何在具有服务ID的IBM Cloud上创建Kubernetes集群?

时间:2018-07-30 10:31:25

标签: api security kubernetes ibm-cloud

我已经在IBM Cloud上创建了IAM(身份和访问管理)service ID。之后,我授予了IBM Cloud Kubernetes Service对该服务ID的管理员特权。

现在,如何使用该服务ID创建集群?我无法使用该ID登录到IBM Cloud。正确的步骤是什么?

1 个答案:

答案 0 :(得分:0)

可以按照以下流程完成:
   1.创建一个API key for that service ID

ibmcloud iam service-api-key-create KeyName ServiceId-identifier \
-d "an optional description" --file save-Api-key2this-file
  1. 使用该API密钥obtain an IAM token for that service ID

    curl -k -X POST   --header "Content-Type: application/x-www-form-urlencoded" \
    --header "Accept: application/json" \
    --data-urlencode "grant_type=urn:ibm:params:oauth:grant-type:apikey" \
    --data-urlencode "apikey=APIKEY-FROM-STEP-1"\
    https://iam.bluemix.net/identity/token
    
  2. 使用REST API for Kubernetes service to create the cluster。提供步骤2中的令牌以进行授权:

    curl -X POST --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'X-Region: eu-de' --header 'Authorization: TOKEN-FROM-STEP2' -d '{ \
      "dataCenter": "fra04", \ 
       "disableAutoUpdate": true, \ 
       "diskEncryption": true, \ 
       "enableTrusted": false, \ 
       "machineType": "u2c.2x4", \ 
       "name": "henrik-paid-fra04-serviceID", \ 
       "noSubnet": true, \ 
       "privateVlan": "2397641", \ 
       "publicVlan": "2397639", \ 
       "workerNum": 2 \ 
     }' 'https://containers.bluemix.net/v1/clusters'