Terraform scripts to provision an OCI cluster, install k3s, and configure Rancher. A complete solution for container infrastructure.
Uncover the magic of container orchestration with this repository! Here you'll find Terraform scripts that, like a maestro, orchestrate the creation of a robust cluster on Oracle Cloud Infrastructure (OCI), install the lightweight and powerful k3s, and finally set up Rancher, the market-leading container management platform. A complete solution to take your container infrastructure to the next level!
This project exists primarily for learning purposes and is not intended to configure an environment with all the characteristics of a production environment, although it serves as a good base example for the same.
- Clone this repository
- Configure your OCI credential variables as local variables using the example
setenv.sh
file that exists in the project, or directly modify theterraform.tfvars
file, as instructed in this file. - Run
terraform init
to initialize Terraform - Run
terraform apply
to create the infrastructure
- First, follow the instructions requested by GitHub.
- Ensure that the OCI credentials variables are properly commented in the
terraform.tfvars
file. cd r3. Include the following SECRETS in your REPOSITORY.TF_API_TOKEN
: Terraform user tokenTF_VAR_private_key_value
: In this case, you will include the file content in the secret value. OCI Credential
- Include the following SECRETS in your ENVIRONMENT.
OCI_NODE_PRIVATEKEY
: Access node with sshOCI_NODE_PUBLICKEY
: Access node with ssh
- Include the following VARIABLES in your REPOSITORY.
TF_VAR_tenancy_ocid
TF_VAR_user_ocid
TF_VAR_fingerprint
TF_VAR_region
- Include the following VARIABLES in your ENVIRONMENT.
TF_ORGANIZATION
: Terraform Clod OrganizationTF_WORKSPACE
: Terraform Clod WorkspaceTF_VAR_COMPARTMENT
: OCI Compartment
When running Terraform locally, ensure that the sudo
command does not prompt for a password. This can be configured in your environment or may have been set by running a previous command using sudo
.
If you already have kubectl
and helm
installed in your local environment, you can simply change the value of the install_kubernetes_tools_on_terraform_execution_environment
variable to false
.
If you wish to execute the Rancher installation directly on the created instance, change the value of the rancher_installation_mode
variable to remote
.
Please follow these considerations when setting up and running the project.
Once the infrastructure is ready, you can configure Rancher. Here are the basic steps:
- Access the Rancher IP address in your browser
- Follow the on-screen instructions to configure Rancher
If you found a bug or would like to add a new feature, feel free to open an issue or a pull request.
- Email: marco.quicula@quicula.com.br
- Website: www.quicula.com.br
- LinkedIn: https://www.linkedin.com/in/marco-quicula/