@@ -15,30 +15,151 @@ The documentation here is for 5.x **only**. The documentation for earlier versio
1515
1616### Clone the repo
1717
18- Clone the git repo and checkout the 5.x branch :
18+ Clone the git repo:
1919
2020```
2121git clone https://github.com/oracle-terraform-modules/terraform-oci-oke.git tfoke
2222cd tfoke
23- git checkout 5.x
2423```
2524
2625### Create
2726
28- Initialize a working directory containing Terraform configuration files, and optionally upgrade module dependencies:
27+ 1 . Create 2 OCI providers and add them to providers.tf:
28+
29+ ```
30+ provider "oci" {
31+ fingerprint = var.api_fingerprint
32+ private_key_path = var.api_private_key_path
33+ region = var.region
34+ tenancy_ocid = var.tenancy_id
35+ user_ocid = var.user_id
36+ }
37+
38+ provider "oci" {
39+ fingerprint = var.api_fingerprint
40+ private_key_path = var.api_private_key_path
41+ region = var.home_region
42+ tenancy_ocid = var.tenancy_id
43+ user_ocid = var.user_id
44+ alias = "home"
45+ }
46+ ```
47+
48+ 2 . Initialize a working directory containing Terraform configuration files, and optionally upgrade module dependencies:
2949```
3050terraform init --upgrade
3151```
3252
33- Run the plan and apply commands to create OKE cluster and other components:
53+ 3 . Create a terraform.tfvars and provide the necessary parameters:
54+
55+ ```
56+ # Identity and access parameters
57+ api_fingerprint = "00:ab:12:34:56:cd:78:90:12:34:e5:fa:67:89:0b:1c"
58+ api_private_key_path = "~/.oci/oci_rsa.pem"
59+
60+ home_region = "us-ashburn-1"
61+ region = "ap-sydney-1"
62+ tenancy_id = "ocid1.tenancy.oc1.."
63+ user_id = "ocid1.user.oc1.."
64+
65+ # general oci parameters
66+ compartment_id = "ocid1.compartment.oc1.."
67+ timezone = "Australia/Sydney"
68+
69+ # ssh keys
70+ ssh_private_key_path = "~/.ssh/id_ed25519"
71+ ssh_public_key_path = "~/.ssh/id_ed25519.pub"
72+
73+ # networking
74+ create_vcn = true
75+ assign_dns = true
76+ lockdown_default_seclist = true
77+ vcn_cidrs = ["10.0.0.0/16"]
78+ vcn_dns_label = "oke"
79+ vcn_name = "oke"
80+
81+ # Subnets
82+ subnets = {
83+ bastion = { newbits = 13, netnum = 0, dns_label = "bastion", create="always" }
84+ operator = { newbits = 13, netnum = 1, dns_label = "operator", create="always" }
85+ cp = { newbits = 13, netnum = 2, dns_label = "cp", create="always" }
86+ int_lb = { newbits = 11, netnum = 16, dns_label = "ilb", create="always" }
87+ pub_lb = { newbits = 11, netnum = 17, dns_label = "plb", create="always" }
88+ workers = { newbits = 2, netnum = 1, dns_label = "workers", create="always" }
89+ pods = { newbits = 2, netnum = 2, dns_label = "pods", create="always" }
90+ }
91+
92+ # bastion
93+ create_bastion = true
94+ bastion_allowed_cidrs = ["0.0.0.0/0"]
95+ bastion_user = "opc"
96+
97+ # operator
98+ create_operator = true
99+ operator_install_k9s = true
100+
101+
102+ # iam
103+ create_iam_operator_policy = "always"
104+ create_iam_resources = true
105+
106+ create_iam_tag_namespace = false // true/*false
107+ create_iam_defined_tags = false // true/*false
108+ tag_namespace = "oke"
109+ use_defined_tags = false // true/*false
110+
111+ # cluster
112+ create_cluster = true
113+ cluster_name = "oke"
114+ cni_type = "flannel"
115+ kubernetes_version = "v1.29.1"
116+ pods_cidr = "10.244.0.0/16"
117+ services_cidr = "10.96.0.0/16"
118+
119+ # Worker pool defaults
120+ worker_pool_size = 0
121+ worker_pool_mode = "node-pool"
122+
123+ # Worker defaults
124+ await_node_readiness = "none"
125+
126+ worker_pools = {
127+ np1 = {
128+ shape = "VM.Standard.E4.Flex",
129+ ocpus = 2,
130+ memory = 32,
131+ size = 1,
132+ boot_volume_size = 50,
133+ kubernetes_version = "v1.29.1"
134+ }
135+ np2 = {
136+ shape = "VM.Standard.E4.Flex",
137+ ocpus = 2,
138+ memory = 32,
139+ size = 3,
140+ boot_volume_size = 150,
141+ kubernetes_version = "v1.29.1"
142+ }
143+ }
144+
145+ # Security
146+ allow_node_port_access = false
147+ allow_worker_internet_access = true
148+ allow_worker_ssh_access = true
149+ control_plane_allowed_cidrs = ["0.0.0.0/0"]
150+ control_plane_is_public = false
151+ load_balancers = "both"
152+ preferred_load_balancer = "public"
153+
154+ ```
155+
156+ 4 . Run the plan and apply commands to create OKE cluster and other components:
34157```
35158terraform plan
36159terraform apply
37160```
38161
39- You can create a Kubernetes cluster with the latest version of Kubernetes available in OKE using this terraform script. By default the ` kubernetes_version ` parameter in terraform.tfvars.example is set as "LATEST". Refer to [ Terraform Options] [ uri-terraform-options ] for other available parameters for OKE.
40-
41- Use the parameter * cluster_name* to change the name of the cluster as needed.
162+ You can create a Kubernetes cluster with the latest version of Kubernetes available in OKE using this terraform script.
42163
43164### Connect
44165
0 commit comments