SDK

通过SDK操纵公有云

基于腾讯云Go SDK开发 下载开发工具集 go get -u github.com/tencentcloud/tencentcloud-sdk-go 为集群准备CVM 从本地开发集群K8S读取安全凭证secretId和secretKey配置信息, 然后把安全凭证传送给SDK客户端 secretId, secretKey:= K8SClient.Secrets("namespace=tencent").Get("cloud-pass") credential := CloudCommon.NewCredential("secretId", "secretKey") client, _ := cvm.NewClient(credential, regions.Beijing) request := cvm.NewAllocateHostsRequest() request.FromJsonString(K8SClient.Configs("namespace=tencent").Get("K8S-TENCENT-PROD")) response, err := client.AllocateHosts(request) 通过ANSIBLE在CVM搭建K8S集群 Ansible.Hosts().Get(response.ToJsonString()) 调用ANSIBLE开始在CVM部署K8S集群

Minio Client

安装mc https://dl.min.io/client/mc/release/windows-amd64/mc.exe mc config host add b2 http://192.168.1.3:9000 B2_keyID B2_applicationKey 本地文件同步到b2 mc cp -r . b2/wubigo/ 安装S3CMD https://github.com/s3tools/s3cmd/releases/download/v2.0.2/s3cmd-2.0.2.tar.gz sudo python setup.py install ~/.s3cfg # Setup endpoint host_base = http://192.168.1.3:9000 host_bucket = http://192.168.1.3:9000 bucket_location = us-east-1 use_https = True # Setup access keys access_key = Q3AM3UQ867SPQQA43P2F secret_key = zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG # Enable S3 v4 signature APIs signature_v2 = False 同步本地文件到B2 s3cmd sync . s3://wubigo/ 总结 在不进行任何优化的情况下,s3cmd比mc传输速度快好几倍

K8S SDK Setup

安装Golang Dep go get -v github.com/tools/godep 安装client-go go get k8s.io/client-go/kubernetes cd $GOPATH/src/k8s.io/client-go git checkout v10.0.0 godep restore ./... 集群外开发 集群内开发