All Projects β†’ elafarge β†’ Karch

elafarge / Karch

Licence: apache-2.0
A Terraform module to create and maintain Kubernetes clusters on AWS easily, relying entirely on kops

Projects that are alternatives of or similar to Karch

Geodesic
πŸš€ Geodesic is a DevOps Linux Distro. We use it as a cloud automation shell. It's the fastest way to get up and running with a rock solid Open Source toolchain. β˜… this repo! https://slack.cloudposse.com/
Stars: ✭ 629 (+1555.26%)
Mutual labels:  aws, terraform, infrastructure-as-code, containers, kubernetes-cluster
Terraform Aws Asg
Terraform AWS Auto Scaling Stack
Stars: ✭ 58 (+52.63%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Terraformer
CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Stars: ✭ 6,316 (+16521.05%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Terraform
Terraform automation for Cloud
Stars: ✭ 121 (+218.42%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Iam Policy Json To Terraform
Small tool to convert an IAM Policy in JSON format into a Terraform aws_iam_policy_document
Stars: ✭ 282 (+642.11%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Terratag
Terratag is a CLI tool that enables users of Terraform to automatically create and maintain tags across their entire set of AWS, Azure, and GCP resources
Stars: ✭ 385 (+913.16%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Kubenow
Deploy Kubernetes. Now!
Stars: ✭ 285 (+650%)
Mutual labels:  aws, terraform, hcl, kubernetes-cluster
Terraform Ecs Fargate
A Terraform template used for provisioning web application stacks on AWS ECS Fargate
Stars: ✭ 293 (+671.05%)
Mutual labels:  aws, terraform, hcl, containers
Terraform Sqs Lambda Trigger Example
Example on how to create a AWS Lambda triggered by SQS in Terraform
Stars: ✭ 31 (-18.42%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Terraform Aws Gitlab Runner
Terraform module for AWS GitLab runners on ec2 (spot) instances
Stars: ✭ 292 (+668.42%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Terraform Modules
Terraform Modules
Stars: ✭ 25 (-34.21%)
Mutual labels:  aws, terraform, hcl, infrastructure-as-code
Aws
A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq.
Stars: ✭ 493 (+1197.37%)
Mutual labels:  aws, terraform, infrastructure-as-code
Infrastructure As Code Talk
Sample code for the talk "Infrastructure-as-code: running microservices on AWS with Docker, ECS, and Terraform"
Stars: ✭ 520 (+1268.42%)
Mutual labels:  aws, terraform, hcl
Terra Aws Core Kube
Terraform configuration to bootstrap a Kubernetes Cluster on top of CoreOS using AWS-EC2 instances
Stars: ✭ 10 (-73.68%)
Mutual labels:  aws, terraform, hcl
Terraform Aws Secure Baseline
Terraform module to set up your AWS account with the secure baseline configuration based on CIS Amazon Web Services Foundations and AWS Foundational Security Best Practices.
Stars: ✭ 596 (+1468.42%)
Mutual labels:  aws, terraform, hcl
Intro To Terraform
Sample code for the blog post series "A Comprehensive Guide to Terraform."
Stars: ✭ 550 (+1347.37%)
Mutual labels:  aws, terraform, hcl
Cloudguardiaas
Check Point CloudGuard Network Security repository containing solution templates, Terraform templates, tools and scripts for deploying and configuring CloudGuard Network Security products.
Stars: ✭ 27 (-28.95%)
Mutual labels:  aws, terraform, hcl
Terraform Aws Cross Account Role
A Terraform module to create an IAM Role for Cross Account delegation.
Stars: ✭ 30 (-21.05%)
Mutual labels:  aws, terraform, hcl
Terracognita
Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration
Stars: ✭ 452 (+1089.47%)
Mutual labels:  aws, terraform, infrastructure-as-code
Tectonic Installer
Install a Kubernetes cluster the CoreOS Tectonic Way: HA, self-hosted, RBAC, etcd Operator, and more
Stars: ✭ 599 (+1476.32%)
Mutual labels:  terraform, hcl, containers

karch - A terraform module to spawn Kubernetes clusters

karch is a Terraform module based on kops aiming at managing (multiple) Kubernetes clusters on AWS. You can see it as "Terraform bindings for kops".

It essentially aims at making it easier to share Kubernetes cluster topologies or even entire stacks built atop Kubernetes.

Motivations

kops has become the standard, non-opinionated way of deploying Kubernetes clusters on AWS and can even generate Terraform code. However, this approach has some limits:

  • Values of resources managed by kops, such as the id of the cluster's VPC, subnets, etc... aren't really accessible from the rest of your codebase.
  • One needs one subfolder per cluster (which can be used as a Terraform module): creating a "cluster template" (masters + several IGs) that can easily be replicated accross AWS regions & shared accross teams isn't possible

It seemed that wrapping by wrapping the kops CLI itself into a Terraform module whicch really feels like a simple Terraform module could fulfill this need for portable, reapeatable infrastructure a bit better. Of course, keeping the flexibilty offered by kops's cluster & instance group spec available by exposing all the parameters it provides as Terraform variables felt essential.

Therfore, karch aims at making it easy to encode Kubernetes cluster topologies using Terraform infrastructure code. For instance, such a topology could be:

  • an instance group for a pool of NginX ingress controllers, mounting ports
  • one for your backend APIs
  • one for stateful apps (databases, data stores...)
  • one, with GPU instances, to run your ML pipeline
  • with Kubernetes to orchestrate all types of workloads

What karch is

  • A Terraform library, written in plain HCL and using essentially kops, sh and awk.
  • A set of two Terraform modules cluster and ig. The former spaws a base cluster, in a new VPC, the latter can be used to spawn instance groups.
  • A wrapper around kops, instead of using kops directly, you'll be using a terraform module to create/update/delete your kops clusters. When necessary, this module will take care of rolling out your instance groups.

What karch isn't

  • A Terraform provider plugin. Writing such a plugin would be nice, but would require much more time to implement.
  • For now, karch spawns only clusters with a private topology. Adding the ability to create public clusters will come next
  • For now, karch takes care of creating a VPC and Route53 zone for your cluster's subdomain. Being able to give it an already existing VPC and/or zone is on the roadmap

Getting started

Requirements

You'll only need kops, kubectl, sh, and the aws-cli (or at least, an AWS account configured accordingly under ~/.aws/credentials).

Creating a Kubernetes cluster

To create a Kubernetes cluster, you can use the kops-cluster module: You can refer to ./kops-cluster/variables.tf for a documented list of all the variables you can pass to the module.

module "kops-cluster" {
  source  = "github.com/elafarge/karch/aws/cluster"
  version = "1.7.1"

  aws-region              = "eu-west-1"

  # Networking & connectivity
  vpc-name                  = "kube-hq"
  vpc-cidr                  = "10.70.0.0/16"
  availability-zones        = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
  kops-topology             = "private"
  trusted-cidrs             = "0.0.0.0/0"
  admin-ssh-public-key-path = "~/.ssh/id_rsa.pub"

  # DNS
  main-zone-id    = "example.com"
  cluster-name    = "kube-hq.example.com"

  # Kops & Kuberntetes
  kops-state-bucket  = "example-com-kops-state"

  # Master
  master-availability-zones = ["eu-west-1a"]
  master-image              = "ami-109d6069"

  # Bastion
  bastion-image        = "ami-109d6069"

  # First minion instance group
  minion-image        = "ami-109d6069"
}

Adding instance groups to the cluster

Here as well, it boils down to simply using a Terraform module. The list of accepted variables can be found under ./kops-ig/variables.tf.

module "ingress-ig" {
  source  = "github.com/elafarge/karch/aws/ig"
  version = "1.7.1"

  aws-region              = "eu-west-1"

  # Master cluster dependency hook
  master-up = "${module.kops-cluster.master-up}"

  # Global config
  name              = "ingress"
  cluster-name      = "kube-hq.example.com"
  kops-state-bucket = "example-com-kops-state"
  visibility        = "private"
  subnets           = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
  image             = "ami-109d6069"
  type              = "t2.small"
  volume-size       = "16"
  volume-type       = "gp2"
  min-size          = 2
  max-size          = 3
  node-labels       = "${map("role.node", "ingress")}"
}

Mainting your cluster

You can entirely rely on Terraform to update your cluster on terraform apply. Please note that we never run kops rolling-update for cluster updates. You'll need to run it manually. However, rolling updates can be automatically applied for instance groups, with a configurable node rollout time interval.

Maintainers

  • Γ‰tienne Lafarge <etienne.lafarge at gmail.com>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].