Skip to content

sebastianczech/terraform-oci-conf-k8s-oracle-cloud

Repository files navigation

terraform-oci-conf-k8s-oracle-cloud

Terraform module to configure free Kubernetes cluster in Oracle Cloud

Prerequisites

  1. Install tools:

Usage

  1. Authenticate to Oracle Cloud:
oci session authenticate --region eu-frankfurt-1 --profile-name k8s-oci

Token can be later refreshed by command:

oci session refresh --profile k8s-oci
  1. Initialize Terraform:
cd examples/basic
terraform init
  1. Prepare file with variables values:
cp example.tfvars terraform.tfvars
vi terraform.tfvars
  1. Apply code for infrastructure:
terraform apply
  1. Use Kubernetes:
mkdir -p  ~/.kube
terraform output -raw microk8s_config_public > ~/.kube/microk8s.conf
export KUBECONFIG=$KUBECONFIG:~/.kube/config:~/.kube/microk8s.conf
kubectl get all --all-namespaces

Requirements

Name Version
terraform >= 1.3.0
external ~> 2.3.3
null ~> 3.2.2
oci ~> 6.11.0
remote 0.1.3
time ~> 0.12.0

Providers

Name Version
external ~> 2.3.3
null ~> 3.2.2
oci ~> 6.11.0
remote 0.1.3
time ~> 0.12.0

Modules

No modules.

Resources

Name Type
null_resource.k8s_cluster_join resource
null_resource.k8s_cluster_setup resource
null_resource.master_setup resource
null_resource.worker_setup resource
time_sleep.wait_60_seconds resource
external_external.microk8s_config data source
oci_network_load_balancer_network_load_balancer.k8s_network_load_balancer data source
remote_file.join_command_token data source

Inputs

Name Description Type Default Required
compute_instances A map of compute instances to create map(any) n/a yes
id_rsa SSH private key string n/a yes
lb_id ID of the load balancer string n/a yes
my_public_ip My public IP address string n/a yes
subnet_cidr CIDR block for the subnet string n/a yes

Outputs

Name Description
master_public_ip The public IP address of the master node
microk8s_config_private The private configuration for microk8s
microk8s_config_public The public configuration for microk8s

License

MIT Licensed. See LICENSE.