Kubernetes

A description how to get started with Kubernetes on Oracle Cloud

Overview

Kubernetes enables running and orchestrating multiple software containers.

Setup Kubernetes Cluster on Oracle Cloud using OKE

Search for OKE in the menu and then go to Kubernetes Clusters (OKE) under Containers & Artifacts: image

Select the region where you would like to create the Cluster: image

Select the compartment where you would like to create the Cluster: image

Quick Create is great and gives a good starting point that works for most applications: image

The defaults are sensible, but Public Workers make it easier to troubleshoot things in the beginning: image

Select the shape you like and 1 worker is good to start (can be increased and changed later!) image

Under advanced you can configure the boot-volume size: image

Add an SSH key for troubleshooting worker nodes: image

Review everything and then hit Create and it should go and set-up everything :) image

That’s how easy it can be to setup a whole Kubernetes cluster :) Thanks OCI team for creating OKE! image

It will take a few minutes until everything is up and running -> Coffee break?

Once everything is ready: image

you can access the cluster and the settings are given when clicking Access Cluster: image

Customizing nodes using Init-scripts

If you configured Public IP addresses for the worker nodes, then you can connect to the nodes for troubleshooting - Click on the node under Nodes -> pool1: image

By default the disks are NOT expanded to the Bootvolume size you configured, so this can be fixed via init scripts. Edit the node pool and under advanced set the inits script: image

This script will expand the disk:

#!/bin/bash
curl --fail -H "Authorization: Bearer Oracle" -L0 http://169.254.169.254/opc/v2/instance/metadata/oke_init_script | base64 --decode >/var/run/oke-init.sh
bash /var/run/oke-init.sh
sudo dd iflag=direct if=/dev/oracleoci/oraclevda of=/dev/null count=1
echo "1" | sudo tee /sys/class/block/`readlink /dev/oracleoci/oraclevda | cut -d'/' -f 2`/device/rescan
sudo /usr/libexec/oci-growfs -y

Then hit Save Changes. To apply these configuration changes you need to Scale the pool to 0 and then backup to 1: image

Cleanup

You can delete the whole cluster to cleanup: image

But be aware that Kubernetes can create resources via API calls, which is great, but it also means that these additionally created resources (like load balancers or storage volumes) will NOT be cleaned up automatically and need to cleaned up manually!

Last modified April 21, 2022: Finalized Kubernetes instructions (8819d72)