# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
require 'oci'
# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config
# Initialize service client with default config file
container_engine_client =
OCI::ContainerEngine::ContainerEngineClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_cluster_response =
container_engine_client.create_cluster(
OCI::ContainerEngine::Models::CreateClusterDetails.new(
name: 'EXAMPLE-name-Value',
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
vcn_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value',
kubernetes_version: 'EXAMPLE-kubernetesVersion-Value',
endpoint_config:
OCI::ContainerEngine::Models::CreateClusterEndpointConfigDetails.new(
subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
nsg_ids: %w[EXAMPLE--Value],
is_public_ip_enabled: true
),
kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value',
freeform_tags: {
'EXAMPLE_KEY_uuRD2' => 'EXAMPLE_VALUE_wmka4JnxHOBBvBs23P10'
},
defined_tags: {
'EXAMPLE_KEY_HHsFl' => { 'EXAMPLE_KEY_UdgiJ' => 'EXAMPLE--Value' }
},
options:
OCI::ContainerEngine::Models::ClusterCreateOptions.new(
service_lb_subnet_ids: %w[EXAMPLE--Value],
kubernetes_network_config:
OCI::ContainerEngine::Models::KubernetesNetworkConfig.new(
pods_cidr: 'EXAMPLE-podsCidr-Value',
services_cidr: 'EXAMPLE-servicesCidr-Value'
),
add_ons:
OCI::ContainerEngine::Models::AddOnOptions.new(
is_kubernetes_dashboard_enabled: false, is_tiller_enabled: false
),
admission_controller_options:
OCI::ContainerEngine::Models::AdmissionControllerOptions.new(
is_pod_security_policy_enabled: true
),
persistent_volume_config:
OCI::ContainerEngine::Models::PersistentVolumeConfigDetails.new(
freeform_tags: {
'EXAMPLE_KEY_tZvWv' => 'EXAMPLE_VALUE_tgYkQQaRy0GMgNyhbc9J'
},
defined_tags: {
'EXAMPLE_KEY_wJkK6' => {
'EXAMPLE_KEY_62x91' => 'EXAMPLE--Value'
}
}
),
service_lb_config:
OCI::ContainerEngine::Models::ServiceLbConfigDetails.new(
freeform_tags: {
'EXAMPLE_KEY_Qalg1' => 'EXAMPLE_VALUE_Ig4gT1F6k6J6x4U0RiBq'
},
defined_tags: {
'EXAMPLE_KEY_tE6nN' => {
'EXAMPLE_KEY_odMtk' => 'EXAMPLE--Value'
}
}
)
),
image_policy_config:
OCI::ContainerEngine::Models::CreateImagePolicyConfigDetails.new(
is_policy_enabled: true,
key_details: [
OCI::ContainerEngine::Models::KeyDetails.new(
kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value'
)
]
),
cluster_pod_network_options: [
OCI::ContainerEngine::Models::FlannelOverlayClusterPodNetworkOptionDetails
.new(cni_type: 'FLANNEL_OVERLAY')
],
type: 'BASIC_CLUSTER'
)
)
# Get the data from response
puts "#{create_cluster_response.headers}"