Skip to content

Scripts to set up a fully functional Kubernetes cluster incl. domain, database, autoscaling & monitoring

Notifications You must be signed in to change notification settings

chapati23/k8-cluster-setup

Repository files navigation

Cluster Setup

This has only been tested and run on macOS. If you're trying this out with Linux and Windows you will have to adapt some commands.

Prerequisites

  • AWS CLI to manage AWS resources

    • pip install --upgrade --user awscli
    • aws configure
  • terraform to create a DB on AWS

    • brew install terraformj
  • jq to parse JSON results returned by the AWS CLI

    • brew install jq
  • chronic to suppress output unless there's a non-zero exit code

    • brew install moreutils
  • envsubst to replace environment variables in templates

    • brew install gettext
  • kops to create the Kubernetes cluster

    • brew install kops
  • kubectl to manage Kubernetes resources

    • brew install kubernetes-cli

How does it work?

1. Create Cluster

The first script 1-create-cluster.sh will:

  • Generate a new ssh key for the cluster
  • Create S3 buckets for the cluster configuration
  • Create IAM groups, users and policies for kops
  • Create the Kubernetes cluster with kops
  • Extract the kubeconfig from the new cluster
  • Encrypt the kubeconfig with openssl
  • Upload the encrypted kubeconfig to S3

2. Create Database

The second script 2-create-database.sh will:

  • Set up the Database credentials
  • Create a PostGres database with AWS RDS
  • Create an S3 bucket for the database config
  • Encrypt the terraform DB state with openssl
  • Upload the encrypted terraform DB state to S3
  • Generate a Kubernetes secret for the backend services to be able to connect to the DB

3. Create Services

The third script 3-create-services.sh will:

About

Scripts to set up a fully functional Kubernetes cluster incl. domain, database, autoscaling & monitoring

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published