Skip navigation

Kubernetes becomes the defacto standard if it comes to managing and scaling your container platform, where you might consider that containers are the next gen infrastructure platforms as a follow up on virtual machines, where every process application or infrastructure component can run in a docker container, autonomous, lightweight and independent, as an application, or a piece of runtime platform software ( such as a Java JDK )

However,  in the greater whole dockercontainers don't stand for themselves and they need some management; they need to be orchestrated and configured in a meaningful way. One of those platforms is called Kubernetes, developed by Google and since it development more and more technologies embraced Kubernetes as the orchestrator platform for containers.

 

Oracle these days is aiming to get customers into cloud, so in this way they developed a Kubernetes cloud solution called OKE which stands for Oracle Kubernetes Engine and is available from the Oracle Cloud Infrastructure.

 

2018-08-29 16_42_32-Clipboard.png

 

In here you can configure all your way through to setup a Kubernetes engine,

 

imageFile.png

 

The good news is that there is an automated way to fo this, using Terraform.

 

Terrafom is a solution which fits perfectly in a DevOps methodology where Infrastructure as a code and automation are keywords to support the DevOps way of working.  Every confgurational aspect to setup networks, loadbalancers, vm's, containers etc can be rolled out using Terraform, and especially cloud infrastructures

Oracle supports Terraform for its Cloud infrastructure since april 2017.

 

Looking at schematics, the Terraform plugin works as below

Now the steps to roll this out are pretty simple however there are some triviial aspects to consider

 

  • You need an OCI userid and obtainan API key by generating a Public and Private key pair

To set this up use a local linux server to do this:

  • Generate the keypair and convert to PEM format
  • Extract the finger print
  • Add an API key to you OCI userid and paste the Public key contents in it

 

Generate and extract the fingerprint

 

Configure Terraform

 

Lucky for me, there is a OKE Terraform installer present on Github, see https://github.com/oracle/terraform-kubernetes-installer so I had to pull and update this github to my local repository

Next, run some pre commands:

cd terraform-kubernetes-installer
terraform init

To rollout the OKE, the TFVars envfile needed the OCI configuration:

 

tenancy_ocid = "the cloud tenancy id"
compartment_ocid = "the compartment id" This one you need to create in the OCI console
fingerprint = "<extracted from the PubPriv Keyoair"
private_key_path = "/home/oracle/.oci/oci_api_key.pem"
user_ocid = "<the OCI user id>"
Region = "< the region of your OCI > (like eu-frankfurt-1)"

 

Comparment creation to be done in the OCI menu->Identity->Compartment.

 

Now when execute the Terraform configurations, the TFVars need to be exported so the best to do this in the .bash_profile

Before applying, evaluate the plan

terraform plan

...etc

Finally apply the configuration to OKE

 

terraform apply

 

It took a some time but after a while my kubernetes master and worker nodes where created in the OCI. This proved that setting up using Terraform is a fast and simple way if you know the trivial parts ( tenant ocid, userocid etc )