Rancher API를 사용하여 EKS, AKS 및 GKE 생성
7221 단어 ekskubernetesawsrancher
새 클러스터를 만들 수 있으려면 범위가 없는 API 토큰을 만들어야 합니다.
아래 명령에서 자격 증명 ID가 "cattle-global-data:cc-XXXX"인 클라우드 공급자에 따라 클라우드 자격 증명을 업데이트합니다.
EKS 클러스터 생성
curl -k -s 'https://rancher.example.com/v3/cluster' -H 'content-type: application/json' -H "Authorization: Bearer $TOKEN" --data-binary '{"dockerRootDir":"/var/lib/docker","enableClusterAlerting":false,"enableClusterMonitoring":false,"enableNetworkPolicy":false,"windowsPreferedCluster":false,"type":"cluster","name":"test","eksConfig":{"imported":false,"amazonCredentialSecret":"cattle-global-data:cc-XXXX","displayName":"test","kmsKey":"","kubernetesVersion":"1.21","loggingTypes":[],"nodeGroups":[{"desiredSize":2,"diskSize":20,"ec2SshKey":"","gpu":false,"imageId":"","instanceType":"t3.medium","labels":{},"maxSize":2,"minSize":2,"nodegroupName":"test","requestSpotInstances":false,"resourceTags":{},"spotInstanceTypes":[],"subnets":[],"tags":{},"type":"nodeGroup","userData":"","launchTemplate":null,"version":"1.21"}],"privateAccess":false,"publicAccess":true,"publicAccessSources":[],"region":"eu-central-1","secretsEncryption":false,"securityGroups":[],"serviceRole":"","subnets":[],"tags":{},"type":"eksclusterconfigspec"},"labels":{}}'
AKS 클러스터 만들기
curl -k -s 'https://rancher.example.com/v3/cluster' -H 'content-type: application/json' -H "Authorization: Bearer $TOKEN" --data-binary '{"dockerRootDir":"/var/lib/docker","enableClusterAlerting":false,"enableClusterMonitoring":false,"enableNetworkPolicy":false,"windowsPreferedCluster":false,"type":"cluster","name":"test","aksConfig":{"imported":false,"azureCredentialSecret":"cattle-global-data:cc-XXXXX","clusterName":"test","dnsPrefix":"test","kubernetesVersion":"1.21.9","linuxAdminUsername":"azureuser","loadBalancerSku":"Standard","networkPlugin":"kubenet","nodePools":[{"availabilityZones":["1","2","3"],"count":1,"enableAutoScaling":false,"maxPods":110,"mode":"System","name":"agentpool","orchestratorVersion":"1.21.9","osDiskSizeGB":128,"osDiskType":"Managed","osType":"Linux","type":"aksnodepool","vmSize":"Standard_DS2_v2","isNew":true}],"privateCluster":false,"resourceGroup":"test","resourceLocation":"northeurope","tags":{},"type":"aksclusterconfigspec"},"labels":{}}'
GKE 클러스터 만들기
curl -k -s 'https://rancher.example.com/v3/cluster' -H 'content-type: application/json' -H "Authorization: Bearer $TOKEN" --data-binary '{"dockerRootDir":"/var/lib/docker","enableClusterAlerting":false,"enableClusterMonitoring":false,"enableNetworkPolicy":false,"windowsPreferedCluster":false,"type":"cluster","name":"test","gkeConfig":{"imported":false,"clusterAddons":{"horizontalPodAutoscaling":true,"httpLoadBalancing":true,"networkPolicyConfig":false},"clusterIpv4Cidr":"","clusterName":"test","description":"","enableKubernetesAlpha":false,"googleCredentialSecret":"cattle-global-data:cc-XXXX","ipAllocationPolicy":{"clusterIpv4CidrBlock":null,"clusterSecondaryRangeName":null,"createSubnetwork":false,"nodeIpv4CidrBlock":null,"servicesIpv4CidrBlock":null,"servicesSecondaryRangeName":null,"subnetworkName":null,"useIpAliases":true,"clusterIpv4Cidr":""},"kubernetesVersion":"1.21.6-gke.1500","labels":{},"locations":["europe-west3-a","europe-west3-b","europe-west3-c"],"loggingService":"logging.googleapis.com/kubernetes","maintenanceWindow":"","masterAuthorizedNetworks":{"enabled":false},"monitoringService":"monitoring.googleapis.com/kubernetes","network":"default","networkPolicyEnabled":false,"nodePools":[{"autoscaling":{"enabled":false,"maxNodeCount":null,"minNodeCount":null},"config":{"diskSizeGb":100,"diskType":"pd-standard","imageType":"COS","labels":{},"localSsdCount":0,"machineType":"n1-standard-2","oauthScopes":["https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append"],"preemptible":false,"taints":null,"tags":null},"initialNodeCount":1,"management":{"autoRepair":true,"autoUpgrade":true},"maxPodsConstraint":110,"name":"test","version":"1.21.6-gke.1500","type":"gkenodepoolconfig","isNew":true}],"privateClusterConfig":{"enablePrivateEndpoint":false,"enablePrivateNodes":false,"masterIpv4CidrBlock":null},"projectID":"XXXXXX","region":"europe-west3","subnetwork":"default","type":"gkeclusterconfigspec","zone":""},"labels":{},"annotations":{}}'
클러스터에 대한 정보 가져오기(예: 테스트)
curl -k -s -u $TOKEN -H 'Content-Type: application/json' 'https://rancher.example.com/v3/clusters?name=test' | jq -r .data[]
클러스터 삭제
curl -k -s -u $TOKEN -X DELETE -H 'Accept: application/json' 'https://rancher.example.com/v1/provisioning.cattle.io.clusters/fleet-default/CLUSTER-ID'
Reference
이 문제에 관하여(Rancher API를 사용하여 EKS, AKS 및 GKE 생성), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/aws-builders/using-rancher-api-to-create-eks-aks-and-gke-3j92텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)