{Alibaba ACK} Create an ACK Serverless cluster by using Alibaba Cloud CLI

https://www.alibabacloud.com/help/ja/ack/serverless-kubernetes/user-guide/create-an-ask-cluster-by-using-alibaba-cloud-cli

 


前提: 
1. コンソールより下記実施済み (実施不要の可能性あり)

1.1 下記権限付与

Cloud Resource Access Authorization
To modify the permissions of a RAM role, log on to the RAM console and go to the RAM Roles page. Make sure that you grant the Alibaba Cloud service the required permissions.

Authorize CS to use the following roles to access your cloud resources.
AliyunCSManagedVKRole
AliyunCSDefaultRole
AliyunCSManagedKubernetesRole
AliyunCSManagedLogRole
AliyunCSManagedCmsRole
AliyunCSManagedCsiRole
AliyunCSKubernetesAuditRole
AliyunCSManagedNetworkRole
AliyunCSManagedArmsRole
AliyunCSServerlessKubernetesRole


1.2 下記権限付与
Below are the roles created by the system that are available for use by the system, and after authorization, the service has the appropriate access to your cloud resources.
AliyunOOSLifecycleHook4CSRole

 

1.3 下記アクティベート済み
プロフェッショナルマネージド Kubernetes クラスターサービスおよび標準マネージド Kubernetes クラスターサービスの両方

Both the professional managed Kubernetes cluster service and the standard managed Kubernetes cluster service will be activated


1.4 下記権限付与
以下は、システムで使用するために作成されたロールです。許可後、サービスにはクラウドリソースに対する適切な権限が付与されます。
AliyunCISDefaultRole

1.5 下記アクティベート済み
Managed Service for Prometheus (従量課金) - 観測可能なデータに基づく課金

1.6 下記アクティベート済み
Apsara File Storage NAS - 従量課金


1.7 下記権限付与
ARMS が権限付与を要求しています。
以下の権限情報を確認し、[権限付与] または [キャンセル] をクリックして操作が完了するまでお待ちください。

AliyunServiceRoleForARMS


2. kubectlインストール済み

 


-- 1. Create an ACK Serverless cluster


cat <<-'EOF' > create.json

{
    "cluster_type": "Ask",
    "name": "cluster11",
    "region_id": "ap-northeast-1",
    "zoneid": "ap-northeast-1a",
    "nat_gateway": true,
    "private_zone": false,
    "tags": [
        {"key": "env", "value": "test"}
    ]
}

EOF

cat create.json

aliyun cs  POST /clusters --header "Content-Type=application/json" --body "$(cat create.json)" 

aliyun cs DescribeClusters 

aliyun cs GET /clusters/111111111111111111111111111111111

ls -l $HOME/.kube/config

KUBECONFIG=$HOME/.kube/config
aliyun cs GET /k8s/111111111111111111111111111111111/user_config | jq -r '.config' > ${KUBECONFIG}

 

cat ${KUBECONFIG}


-- 2. Test the ACK Serverless cluster


kubectl get nodes

kubectl run hello-world --image hello-world --restart=Never
kubectl get pod
kubectl logs pod/hello-world
kubectl delete pod/hello-world
kubectl get pod


-- 3. Delete and release resources


aliyun cs DELETE /clusters/111111111111111111111111111111111

aliyun cs DescribeClusters