Skip to content

Commit 1d7c7b4

Browse files
committed
add
1 parent 4cf378f commit 1d7c7b4

File tree

2 files changed

+151
-51
lines changed

2 files changed

+151
-51
lines changed

tencentcloud/services/tke/resource_tc_kubernetes_cluster.md

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ resource "tencentcloud_kubernetes_cluster" "example" {
135135
"test2" = "test2",
136136
}
137137
}
138-
139138
```
140139

141140
Create an empty cluster with a node pool
@@ -261,7 +260,6 @@ resource "tencentcloud_kubernetes_node_pool" "example" {
261260
]
262261
}
263262
}
264-
265263
````
266264
267265
Create a cluster with a node pool and open the network access with cluster endpoint
@@ -715,17 +713,16 @@ variable "default_instance_type" {
715713
}
716714
717715
resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
718-
vpc_id = var.vpc
719-
cluster_max_pod_num = 32
720-
cluster_name = "test"
721-
cluster_desc = "test cluster desc"
722-
cluster_max_service_num = 256
723-
cluster_internet = true
724-
# managed_cluster_internet_security_policies = ["3.3.3.3", "1.1.1.1"]
725-
cluster_deploy_type = "MANAGED_CLUSTER"
726-
network_type = "VPC-CNI"
727-
eni_subnet_ids = ["subnet-bk1etlyu"]
728-
service_cidr = "10.1.0.0/24"
716+
vpc_id = var.vpc
717+
cluster_max_pod_num = 32
718+
cluster_name = "test"
719+
cluster_desc = "test cluster desc"
720+
cluster_max_service_num = 256
721+
cluster_internet = true
722+
cluster_deploy_type = "MANAGED_CLUSTER"
723+
network_type = "VPC-CNI"
724+
eni_subnet_ids = ["subnet-bk1etlyu"]
725+
service_cidr = "10.1.0.0/24"
729726
730727
worker_config {
731728
count = 1
@@ -746,8 +743,8 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
746743
enhanced_security_service = false
747744
enhanced_monitor_service = false
748745
user_data = "dGVzdA=="
749-
# password = "ZZXXccvv1212" // Optional, should be set if key_ids not set.
750746
key_ids = "skey-11112222"
747+
# password = "ZZXXccvv1212" // Optional, should be set if key_ids not set.
751748
}
752749
753750
labels = {
@@ -783,30 +780,57 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
783780
```
784781

785782
Create a CDC scenario cluster
783+
786784
```
787785
resource "tencentcloud_kubernetes_cluster" "cdc_cluster" {
788-
cdc_id = "cluster-xxxxx"
789-
vpc_id = "vpc-xxxxx"
790-
cluster_cidr = "192.168.0.0/16"
791-
cluster_max_pod_num = 64
792-
cluster_name = "test-cdc"
793-
cluster_desc = "test cluster desc"
794-
cluster_max_service_num = 1024
795-
cluster_version = "1.30.0"
796-
797-
cluster_os = "tlinux3.1x86_64"
798-
cluster_level = "L20"
799-
cluster_deploy_type = "INDEPENDENT_CLUSTER"
800-
801-
container_runtime = "containerd"
802-
runtime_version = "1.6.9"
803-
pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw="
804-
exist_instance {
805-
node_role = "MASTER_ETCD"
806-
instances_para {
807-
instance_ids = ["ins-eeijdk16", "ins-84ku5rba", "ins-8oa3im2s"]
786+
cdc_id = "cluster-262n63e8"
787+
vpc_id = "vpc-0m6078eb"
788+
cluster_cidr = "192.168.0.0/16"
789+
cluster_max_pod_num = 64
790+
cluster_name = "test-cdc"
791+
cluster_desc = "test cluster desc"
792+
cluster_max_service_num = 1024
793+
cluster_version = "1.30.0"
794+
cluster_os = "tlinux3.1x86_64"
795+
cluster_level = "L20"
796+
cluster_deploy_type = "INDEPENDENT_CLUSTER"
797+
container_runtime = "containerd"
798+
runtime_version = "1.6.9"
799+
pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw="
800+
instance_delete_mode = "retain"
801+
exist_instance {
802+
node_role = "MASTER_ETCD"
803+
instances_para {
804+
instance_ids = ["ins-mam0c7lw", "ins-quvwayve", "ins-qbffk8iw"]
805+
enhanced_security_service = true
806+
enhanced_monitor_service = true
807+
password = "Password@123"
808+
security_group_ids = ["sg-hjs685q9"]
809+
master_config {
810+
mount_target = "/var/data"
811+
docker_graph_path = "/var/lib/containerd"
812+
unschedulable = 0
813+
labels {
814+
name = "key"
815+
value = "value"
816+
}
817+
data_disk {
818+
file_system = "ext4"
819+
auto_format_and_mount = true
820+
mount_target = "/var/data"
821+
disk_partition = "/dev/vdb"
808822
}
823+
extra_args {
824+
kubelet = ["root-dir=/root"]
825+
}
826+
taints {
827+
key = "key"
828+
value = "value"
829+
effect = "NoSchedule"
830+
}
831+
}
809832
}
833+
}
810834
}
811835
```
812836

website/docs/r/kubernetes_cluster.html.markdown

Lines changed: 93 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,10 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
730730
cluster_desc = "test cluster desc"
731731
cluster_max_service_num = 256
732732
cluster_internet = true
733-
# managed_cluster_internet_security_policies = ["3.3.3.3", "1.1.1.1"]
734-
cluster_deploy_type = "MANAGED_CLUSTER"
735-
network_type = "VPC-CNI"
736-
eni_subnet_ids = ["subnet-bk1etlyu"]
737-
service_cidr = "10.1.0.0/24"
733+
cluster_deploy_type = "MANAGED_CLUSTER"
734+
network_type = "VPC-CNI"
735+
eni_subnet_ids = ["subnet-bk1etlyu"]
736+
service_cidr = "10.1.0.0/24"
738737
739738
worker_config {
740739
count = 1
@@ -755,8 +754,8 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
755754
enhanced_security_service = false
756755
enhanced_monitor_service = false
757756
user_data = "dGVzdA=="
757+
key_ids = "skey-11112222"
758758
# password = "ZZXXccvv1212" // Optional, should be set if key_ids not set.
759-
key_ids = "skey-11112222"
760759
}
761760
762761
labels = {
@@ -795,26 +794,52 @@ resource "tencentcloud_kubernetes_cluster" "managed_cluster" {
795794

796795
```hcl
797796
resource "tencentcloud_kubernetes_cluster" "cdc_cluster" {
798-
cdc_id = "cluster-xxxxx"
799-
vpc_id = "vpc-xxxxx"
797+
cdc_id = "cluster-262n63e8"
798+
vpc_id = "vpc-0m6078eb"
800799
cluster_cidr = "192.168.0.0/16"
801800
cluster_max_pod_num = 64
802801
cluster_name = "test-cdc"
803802
cluster_desc = "test cluster desc"
804803
cluster_max_service_num = 1024
805804
cluster_version = "1.30.0"
806-
807-
cluster_os = "tlinux3.1x86_64"
808-
cluster_level = "L20"
809-
cluster_deploy_type = "INDEPENDENT_CLUSTER"
810-
811-
container_runtime = "containerd"
812-
runtime_version = "1.6.9"
813-
pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw="
805+
cluster_os = "tlinux3.1x86_64"
806+
cluster_level = "L20"
807+
cluster_deploy_type = "INDEPENDENT_CLUSTER"
808+
container_runtime = "containerd"
809+
runtime_version = "1.6.9"
810+
pre_start_user_script = "aXB0YWJsZXMgLUEgSU5QVVQgLXAgdGNwIC1zIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAppcHRhYmxlcyAtQSBPVVRQVVQgLXAgdGNwIC1kIDE2OS4yNTQuMC4wLzE5IC0tdGNwLWZsYWdzIFNZTixSU1QgU1lOIC1qIFRDUE1TUyAtLXNldC1tc3MgMTE2MAoKZWNobyAnCmlwdGFibGVzIC1BIElOUFVUIC1wIHRjcCAtcyAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKaXB0YWJsZXMgLUEgT1VUUFVUIC1wIHRjcCAtZCAxNjkuMjU0LjAuMC8xOSAtLXRjcC1mbGFncyBTWU4sUlNUIFNZTiAtaiBUQ1BNU1MgLS1zZXQtbXNzIDExNjAKJyA+PiAvZXRjL3JjLmQvcmMubG9jYWw="
811+
instance_delete_mode = "retain"
814812
exist_instance {
815813
node_role = "MASTER_ETCD"
816814
instances_para {
817-
instance_ids = ["ins-eeijdk16", "ins-84ku5rba", "ins-8oa3im2s"]
815+
instance_ids = ["ins-mam0c7lw", "ins-quvwayve", "ins-qbffk8iw"]
816+
enhanced_security_service = true
817+
enhanced_monitor_service = true
818+
password = "Password@123"
819+
security_group_ids = ["sg-hjs685q9"]
820+
master_config {
821+
mount_target = "/var/data"
822+
docker_graph_path = "/var/lib/containerd"
823+
unschedulable = 0
824+
labels {
825+
name = "key"
826+
value = "value"
827+
}
828+
data_disk {
829+
file_system = "ext4"
830+
auto_format_and_mount = true
831+
mount_target = "/var/data"
832+
disk_partition = "/dev/vdb"
833+
}
834+
extra_args {
835+
kubelet = ["root-dir=/root"]
836+
}
837+
taints {
838+
key = "key"
839+
value = "value"
840+
effect = "NoSchedule"
841+
}
842+
}
818843
}
819844
}
820845
}
@@ -973,6 +998,15 @@ The `data_disk` object of `master_config` supports the following:
973998
* `mount_target` - (Optional, String, ForceNew) Mount target.
974999
* `snapshot_id` - (Optional, String, ForceNew) Data disk snapshot ID.
9751000

1001+
The `data_disk` object of `master_config` supports the following:
1002+
1003+
* `auto_format_and_mount` - (Optional, Bool, ForceNew) Indicate whether to auto format and mount or not. Default is `false`.
1004+
* `disk_partition` - (Optional, String, ForceNew) The name of the device or partition to mount. NOTE: this argument doesn't support setting in node pool, or will leads to mount error.
1005+
* `disk_size` - (Optional, Int, ForceNew) Volume of disk in GB. Default is `0`.
1006+
* `disk_type` - (Optional, String, ForceNew) Types of disk. Valid value: `LOCAL_BASIC`, `LOCAL_SSD`, `CLOUD_BASIC`, `CLOUD_PREMIUM`, `CLOUD_SSD`, `CLOUD_HSSD`, `CLOUD_TSSD` and `CLOUD_BSSD`.
1007+
* `file_system` - (Optional, String, ForceNew) File system, e.g. `ext3/ext4/xfs`.
1008+
* `mount_target` - (Optional, String, ForceNew) Mount target.
1009+
9761010
The `data_disk` object of `worker_config` supports the following:
9771011

9781012
* `auto_format_and_mount` - (Optional, Bool, ForceNew) Indicate whether to auto format and mount or not. Default is `false`.
@@ -1003,15 +1037,51 @@ The `extension_addon` object supports the following:
10031037
* `name` - (Required, String) Add-on name.
10041038
* `param` - (Required, String) Parameter of the add-on resource object in JSON string format, please check the example at the top of page for reference.
10051039

1040+
The `extra_args` object of `master_config` supports the following:
1041+
1042+
* `kubelet` - (Optional, List, ForceNew) Kubelet custom parameter. The parameter format is ["k1=v1", "k1=v2"].
1043+
1044+
The `gpu_args` object of `master_config` supports the following:
1045+
1046+
* `cuda` - (Optional, Map, ForceNew) CUDA version. Format like: `{ version: String, name: String }`. `version`: Version of GPU driver or CUDA; `name`: Name of GPU driver or CUDA.
1047+
* `cudnn` - (Optional, Map, ForceNew) cuDNN version. Format like: `{ version: String, name: String, doc_name: String, dev_name: String }`. `version`: cuDNN version; `name`: cuDNN name; `doc_name`: Doc name of cuDNN; `dev_name`: Dev name of cuDNN.
1048+
* `custom_driver` - (Optional, Map, ForceNew) Custom GPU driver. Format like: `{address: String}`. `address`: URL of custom GPU driver address.
1049+
* `driver` - (Optional, Map, ForceNew) GPU driver version. Format like: `{ version: String, name: String }`. `version`: Version of GPU driver or CUDA; `name`: Name of GPU driver or CUDA.
1050+
* `mig_enable` - (Optional, Bool, ForceNew) Whether to enable MIG.
1051+
10061052
The `instances_para` object of `exist_instance` supports the following:
10071053

10081054
* `instance_ids` - (Required, List, ForceNew) Cluster IDs.
1055+
* `enhanced_monitor_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud monitor service. Default is TRUE.
1056+
* `enhanced_security_service` - (Optional, Bool, ForceNew) To specify whether to enable cloud security service. Default is TRUE.
1057+
* `key_ids` - (Optional, List, ForceNew) ID list of keys, should be set if `password` not set.
1058+
* `master_config` - (Optional, List, ForceNew) Advanced Node Settings. commonly used to attach existing instances.
1059+
* `password` - (Optional, String, ForceNew) Password to access, should be set if `key_ids` not set.
1060+
* `security_group_ids` - (Optional, List, ForceNew) Security groups to which a CVM instance belongs.
1061+
1062+
The `labels` object of `master_config` supports the following:
1063+
1064+
* `name` - (Required, String, ForceNew) Name of map.
1065+
* `value` - (Required, String, ForceNew) Value of map.
10091066

10101067
The `log_agent` object supports the following:
10111068

10121069
* `enabled` - (Required, Bool) Whether the log agent enabled.
10131070
* `kubelet_root_dir` - (Optional, String) Kubelet root directory as the literal.
10141071

1072+
The `master_config` object of `instances_para` supports the following:
1073+
1074+
* `data_disk` - (Optional, List, ForceNew) Configurations of data disk.
1075+
* `desired_pod_number` - (Optional, Int, ForceNew) Indicate to set desired pod number in node. valid when the cluster is podCIDR.
1076+
* `docker_graph_path` - (Optional, String, ForceNew) Docker graph path. Default is `/var/lib/docker`.
1077+
* `extra_args` - (Optional, List, ForceNew) Custom parameter information related to the node. This is a white-list parameter.
1078+
* `gpu_args` - (Optional, List, ForceNew) GPU driver parameters.
1079+
* `labels` - (Optional, List, ForceNew) Node label list.
1080+
* `mount_target` - (Optional, String, ForceNew) Mount target. Default is not mounting.
1081+
* `taints` - (Optional, List, ForceNew) Node taint.
1082+
* `unschedulable` - (Optional, Int, ForceNew) Set whether the joined nodes participate in scheduling, with a default value of 0, indicating participation in scheduling; Non 0 means not participating in scheduling.
1083+
* `user_script` - (Optional, String, ForceNew) User script encoded in base64, which will be executed after the k8s component runs. The user needs to ensure the script's reentrant and retry logic. The script and its generated log files can be viewed in the node path /data/ccs_userscript/. If the node needs to be initialized before joining the schedule, it can be used in conjunction with the `unschedulable` parameter. After the final initialization of the userScript is completed, add the command "kubectl uncordon nodename --kubeconfig=/root/.kube/config" to add the node to the schedule.
1084+
10151085
The `master_config` object supports the following:
10161086

10171087
* `instance_type` - (Required, String, ForceNew) Specified types of CVM instance.
@@ -1060,6 +1130,12 @@ The `resource_delete_options` object supports the following:
10601130
* `resource_type` - (Required, String) Resource type, valid values are `CBS`, `CLB`, and `CVM`.
10611131
* `skip_deletion_protection` - (Optional, Bool) Whether to skip resources with deletion protection enabled, the default is false.
10621132

1133+
The `taints` object of `master_config` supports the following:
1134+
1135+
* `effect` - (Optional, String, ForceNew) Effect of the taint.
1136+
* `key` - (Optional, String, ForceNew) Key of the taint.
1137+
* `value` - (Optional, String, ForceNew) Value of the taint.
1138+
10631139
The `worker_config` object supports the following:
10641140

10651141
* `instance_type` - (Required, String, ForceNew) Specified types of CVM instance.

0 commit comments

Comments
 (0)