Giter Club home page Giter Club logo

openstack-kubernetes's Introduction

OpenStack Kubernetes based Developer Platform

A repo for showcasing a basic developer platform on an OpenStack Magnum Kubernetes Cluster, provisioned through Terraform.

Current Features:

  • Provision using Terraform from a custom Magnum Cluster Template
  • Configure Persistent Storage Class for OpenStack
  • Setup cert-manager for X.509 certificate management using Terraform
  • Setup internal NGINX Ingress Controller using Terraform, with auto provisioning cluster wide DNS hostname
  • Optional setup of a Rook Ceph storage cluster, see rook-ceph.md
  • Actions Runner Controller (ARC) for self-hosted GitHub workflow runners, providing an internal CI and code build platform
  • Argo CD (continuous delivery) for the cluster (see /argo-cd/argo/commands.sh for installation instructions)
  • Deploy an example app with valid SSL certificate using Terraform

Prerequisites:

  • Have appropriate OpenStack allocation (Clusters / Networks / FloatingIPs etc.), you can configure the resources used for cluster in the Cluster Template definition, here: main.tf
    • The supplied config needs following main resources:
      • 1 Cluster
      • 1 Network
      • 1 Router
      • 2 Floating IPs (one for cluster's main load-balancer, and one for NGINX Ingress Controller)
      • Appropriate compute and storage allocations as defined in the cluster template
  • Be authenticated with OpenStack using Application/Personal credentials file
  • Install Terraform
  • Install kubectl (this may already be installed if you have Docker Desktop installed), I have an alias for it shortened to k
  • Setup secrets directory with an already created/configured ssh key (password less), set or pass its path to /cluster/variables.tf file

Magnum Cluster

The main terraform module creates a custom Magnum ClusterTemplate which is supported by the provider and configured to work with upcoming use-cases. See https://docs.openstack.org/magnum/latest/user/#clustertemplate for details of all parameters and labels.

Create a Kubernetes cluster

cd cluster
terraform init
terraform apply

Wait for 5-15 minutes for cluster to be deployed

Cluster KUBECONFIG

After the cluster is provisioned the kubeconfig file will be saved at ./cluster/secret/config. Load this config into env variable:

export KUBECONFIG=<PATH_TO_REPO>/cluster/secret/config

Configure Cluster

After the cluster is created we will need to configure it for our use cases like:

  • Set up the cinder StorageClass as default, for all PersistentStorageClaims in the cluster
  • Install CRDs for utility packages like cert-manger and argo-cd or more.

To configure cluster, check/update the path to kubeconfig in the ./cluster/provision/variables.tf file. Then:

cd cluster/configure
terraform init
terraform apply

After this complete a StorageClass named default will be setup and be available to be used by Kubernetes cluster.

Setup Cluster Addons

Now that we have a working cluster setup, we can install and configure some essential cluster addons. Following addons will be installed:

  • NGINX Ingress Controller, will be default Ingress Controller for our cluster, a DNS hostname for whole cluster will be provisioned from OpenStack using designate API, configure this in variables.tf
  • cert-manager, will automatically manage X.509 certificates in our cluster.
  • Argo CD, will be setup to enable continuous deployment of user workloads

Installation Methods

There are multiple ways to install packages into our cluster here are few options:

  • Manual install using yaml files
  • Use Helm charts
  • Use Kubernetes and Helm Terraform providers to setup packages

Use Kubernetes + Helm Terraform providers to setup addons

cd addons-terraform
terraform init
terraform apply

(Optional) Manually setup cert-man using yaml manifests

See Manually configure cert-man

Deploying workloads (applications) to the cluster

Following repo has an example application (Quarkus based API with PostgreSQL db), with the instructions to deploy to this kubernetes cluster: Deploy Example App.

openstack-kubernetes's People

Contributors

mumeraltaf avatar

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.