Skip to content

Latest commit

 

History

History

ack-spot-flannel

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Demostration Cluster for CloudPilot AI

Using this tutorial, you can create a demonstration Aliyun cluster to try CloudPilot AI.

Prerequisites

  • aliyun cli If you use Linux, run the following command to install the aliyun cli:
    wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz
    tar -zxvf aliyun-cli-linux-latest-amd64.tgz
    mv aliyun /usr/local/bin/
  • terraform
  • kubectl

Run the following command to configure the aliyun cli with your aliyun credentials:

aliyun configure

Usage

Configure the aliyun cridentials environment variables:

export ALICLOUD_ACCESS_KEY=<aliyun access key>
export ALICLOUD_SECRET_KEY=<aliyun secret key>
export ALICLOUD_REGION="cn-shenzhen"   

The, download the repository:

git clone https://github.com/cloudpilot-ai/examples.git
cd examples/clusters/ack-spot-flannel

Execute the following command to create the ACK cluster:

export TF_VAR_CLUSTER_NAME=<your_cluster_name>
terraform init
terraform apply --auto-approve

After finish the process, run the following command to get the kubeconfig:

export CLUSTER_NAME=<your_cluster_name>
export KUBECONFIG=~/.kube/demo
export CLUSTER_ID=$(aliyun cs GET /clusters | jq -r --arg CLUSTER_NAME "$CLUSTER_NAME" '.[] | select(.name == $CLUSTER_NAME) | .cluster_id')
aliyun cs GET /k8s/$CLUSTER_ID/user_config | jq -r '.config' > $KUBECONFIG

Then testing the cluster:

kubectl get nodes

When you finish the testing, please run the following command to destroy the cluster:

Note

If you have workloads deployed in your cluster, you need to remove these workloads first. Especially, services associated with load balancers (LB) may cause dependencies that are cumbersome to resolve manually if not addressed before cluster termination

terraform destroy --auto-approve