Giter Site home page Giter Site logo

owainlewis / oci-kubeadm Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 7.0 130 KB

Automation, documentation and tutorials for running Kubernetes on Oracle Cloud Infrastructure.

Makefile 3.23% HCL 84.78% Shell 12.00%
kubernetes oracle-cloud-infrastructure kubeadm ansible oracle

oci-kubeadm's Introduction

Kubeadm Ansible Playbook (Oracle Cloud Infrastructure)

This project will help you create a Kubernetes cluster on Oracle Cloud Infrastructure. It uses Terraform to provision infrastructure and Ansible to configure and install Kubernetes.

In an effort to keep things simple, this project only targets CentOS and Oracle Linux as well as ignoring kubeadm upgrades (for now!).

Prerequisites

  1. Terraform
  2. Ansible
  3. The Terraform provider for OCI
  4. An Oracle Cloud Infrastructure account

Getting started

  1. Create the OCI infrastructure for your cluster. This requires a recent install of the OCI terraform provider.
# Update main.tf with your personal settings
cp main.tf.example main.tf
# Run Terraform
make create
  1. Run Ansible to create a new kubeadm K8s cluster
make ansible

An admin.conf kubeconfig file will be created in the ansible directory.

Verify the cluster has been created successfully

➜  oci-kubeadm git:(master) KUBECONFIG=ansible/admin.conf kubectl get nodes
NAME                STATUS    ROLES     AGE       VERSION
k8s-master-ad-1-0   Ready     master    3h        v1.12.2
k8s-node-ad-1-0     Ready     <none>    3h        v1.12.2
k8s-node-ad-2-0     Ready     <none>    3h        v1.12.2
k8s-node-ad-3-0     Ready     <none>    3h        v1.12.2

Note

If you want to use Instance Principal authentication, make sure you have a dynamic group setup with permissions that targets the instances in your cluster.

Example

Create a dynamic group for your instances:

All {instance.compartment.id = 'ocid1.compartment.oc1..'}

Create a policy that grants the instances appropriate permissions:

Allow group id DYNAMIC_GROUP_OCID to manage all-resources in compartment id COMPARTMENT_OCID
  1. Run hack/inventory.sh to auto generate an Ansible inventory file and CCM configuration file.
➜  oci-kubeadm git:(master) ✗ ./hack/inventory.sh
Writing hosts.ini file to ansible/hosts.ini
Writing cloud-provider-config file to ansible/roles/addons/ccm/templates/cloud-provider-config.yaml.j2

Install CCM

Install the Oracle Cloud Controller Manager (CCM) into your newly created K8s cluster.

➜  oci-kubeadm git:(master) ✗ make ccm

Check that the CCM has succesfully installed. If everything is working your nodes should be labelled correctly with OCI information.

➜  oci-kubeadm git:(master) ✗ k get node k8s-node-ad-1-0  -o go-template='{{range $k, $v := .metadata.labels}}{{$k}}={{$v}}{{"\n"}}{{end}}'
beta.kubernetes.io/arch=amd64
beta.kubernetes.io/instance-type=VM.Standard1.1
beta.kubernetes.io/os=linux
failure-domain.beta.kubernetes.io/region=eu-frankfurt-1
failure-domain.beta.kubernetes.io/zone=EU-FRANKFURT-1-AD-1
kubernetes.io/hostname=k8s-node-ad-1-0

Optional tasks

Install the block storage and file storage (NFS) provisioner

make provisioner

Install the OCI Flexdriver.

kubectl create secret generic \
oci-flexvolume-driver-kubeconfig \
-n kube-system\
--from-file=kubeconfig=ansible/admin.conf

kubectl create secret generic \
oci-flexvolume-driver \
-n kube-system \
--from-file=config.yaml=flexvolume-config.yaml

oci-kubeadm's People

Contributors

owainlewis avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

oci-kubeadm's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.