【问题标题】:How to create Kubernetes cluster on IBM Cloud with service ID?如何使用服务 ID 在 IBM Cloud 上创建 Kubernetes 集群?
【发布时间】:2018-08-21 20:47:16
【问题描述】:

我在 IBM Cloud 上创建了一个 IAM(身份和访问管理)service ID。此后,我将 IBM Cloud Kubernetes Service 的管理员权限授予该服务 ID。

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

【问题讨论】:

    标签: api security kubernetes ibm-cloud


    【解决方案1】:

    可以按照以下流程完成:
    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'
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-09
      • 2019-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-03
      • 2020-07-24
      • 1970-01-01
      相关资源
      最近更新 更多