All Projects → hajowieland → cdk-py-k8s-the-real-hard-way-aws

hajowieland / cdk-py-k8s-the-real-hard-way-aws

Licence: GPL-3.0 license
Python CDK code for "Kubernetes The (real) Hard Way (AWS)"

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to cdk-py-k8s-the-real-hard-way-aws

kube-install
一鍵安裝部署高可用的多kubernetes集羣(二進位離線方式),支持定時安裝、添加與銷毀node、銷毀與修復master、一鍵卸載集羣等。One click offline installation of highly available multiple kubernetes cluster, supports schedule installation, addition of nodes, rebuild of kubernetes master, and uninstallation of clusters.
Stars: ✭ 336 (+2300%)
Mutual labels:  etcd, k8s
awesome
A curated list of delightful developers resources.
Stars: ✭ 13 (-7.14%)
Mutual labels:  k8s, cka
CKA-Exercises
A set of curated exercises to help prepare you for the Certified Kubernetes Administrator Exam by the Cloud Native Computing Foundation
Stars: ✭ 51 (+264.29%)
Mutual labels:  k8s, cka
Arkade
Open Source Kubernetes Marketplace
Stars: ✭ 2,343 (+16635.71%)
Mutual labels:  k8s, cka
Kubeasz
使用Ansible脚本安装K8S集群,介绍组件交互原理,方便直接,不受国内网络环境影响
Stars: ✭ 7,629 (+54392.86%)
Mutual labels:  etcd, k8s
kube-toolkit
Toolkit for creating gRPC-based CLI and web tools for Kubernetes
Stars: ✭ 74 (+428.57%)
Mutual labels:  etcd, k8s
Kubernetes Certified Administrator
Online resources that will help you prepare for taking the CNCF CKA 2020 "Kubernetes Certified Administrator" Certification exam. with time, This is not likely the comprehensive up to date list - please make a pull request if there something that should be added here.
Stars: ✭ 3,438 (+24457.14%)
Mutual labels:  k8s, cka
K8s
Deploying Kubernetes High Availability Cluster with Ansible Playbook
Stars: ✭ 125 (+792.86%)
Mutual labels:  etcd, k8s
Etcd Cloud Operator
Deploying and managing production-grade etcd clusters on cloud providers: failure recovery, disaster recovery, backups and resizing.
Stars: ✭ 149 (+964.29%)
Mutual labels:  etcd, k8s
hcloud-ip-floater
k8s controller for Hetzner Cloud floating IPs
Stars: ✭ 43 (+207.14%)
Mutual labels:  k8s
micro-service-practice
OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 25 (+78.57%)
Mutual labels:  k8s
libvirt-ocp4-provisioner
Automate your OCP4 installation
Stars: ✭ 82 (+485.71%)
Mutual labels:  k8s
rds-snapshot-export-to-s3-pipeline
RDS Snapshot Export to S3 Pipeline
Stars: ✭ 88 (+528.57%)
Mutual labels:  aws-cdk
github-task-manager
receive github hook, notify agent, receive task results, notify github
Stars: ✭ 13 (-7.14%)
Mutual labels:  k8s
k3s-vagrant
k3s k8s cluster playground
Stars: ✭ 39 (+178.57%)
Mutual labels:  k8s
fury-kubernetes-opa
Kubernetes Fury OPA. Policy enforcement for your Kubernetes Cluster
Stars: ✭ 34 (+142.86%)
Mutual labels:  k8s
charts
Helm charts for creating reproducible and maintainable deployments of Polyaxon with Kubernetes.
Stars: ✭ 32 (+128.57%)
Mutual labels:  k8s
Helm-Cheat-Sheet
A cheat sheet for Helm commands.
Stars: ✭ 72 (+414.29%)
Mutual labels:  k8s
k0otkit
k0otkit is a universal post-penetration technique which could be used in penetrations against Kubernetes clusters.
Stars: ✭ 217 (+1450%)
Mutual labels:  k8s
Lecture k8s starter.kit
'쉽게 시작하는 쿠버네티스' 온라인 강의
Stars: ✭ 58 (+314.29%)
Mutual labels:  k8s

CDK Python - Kubernetes The (real) Hard Way on AWS!

This little project creates the infrastructure in CDK Python for my blog post Kubernetes The (real) Hard Way on AWS.

Terraform code available 🔗HERE

You can practice creating a multi node K8s Cluster yourself for training purposes or CKA exam preparation.

Alt text

Requirements

  • Existing AWS EC2 Key Pair
  • Existing AWS Route53 Public Hosted Zone
  • aws-cli Profile
  • AWS CDK (npm install -g cdk)
  • Python3

Features

Default values - you can adapt all of them to your needs

  • AWS CDK Python
  • 1x VPC, 3x Public Subnets, 3x Private Subnets, Route Tables, Routes
  • 3x Worker Nodes
  • 3x Master Nodes
  • 3x Etcd Nodes
  • 1x Bastion Host
  • Route53 Records for internal & external IPv4 addresses
  • 1x Public LoadBalancer for Master Nodes (external kubectl access)
  • 1x Private LoadBalancer for Master Nodes (fronting kube-apiservers)
  • 1x Public LoadBalancer for Bation Host (AutoScalingGroup)
  • Gets most recent Ubuntu AMI for all regions (via Boto3)
  • Install awscli, cfssl, cfssl_json via UserData
  • Allows external access from workstation IPv4 address only (to Bastion & MasterPublicLB)

Variables

Name Description Type Default
aws_account AWS account ID to deploy infrastructure string ''
aws_region AWS region string 'us-east-1'
bastion_desired_capacity Bastion ASG desired nodes int 1
bastion_instance_type Bastion EC2 instance type string 't3a.small'
bastion_min_capacity Bastion ASG min. nodes int 1
bastion_max_capacity Bastion ASG max. nodes int 1
etcd_desired_capacity etcd ASG desired nodes int 3
etcd_instance_type etcd EC2 instance type string 't3a.small'
etcd_min_capacity etcd ASG min. nodes int 3
etcd_max_capacity etcd ASG max. nodes int 3
master_desired_capacity K8s-Master ASG desired nodes int 3
master_instance_type K8s-Master EC2 instance type string 't3a.small'
master_min_capacity K8s-Master ASG min. nodes int 3
master_max_capacity K8s-Master ASG max. nodes int 3
worker_desired_capacity K8s-Worker ASG desired nodes int 3
worker_instance_type K8s-Worker EC2 instance type string 't3a.small'
worker_min_capacity K8s-Worker ASG min. nodes int 3
worker_max_capacity K8s-Worker ASG max. nodes int 3
ssh_key_pair AWS EC2 Key Pair name string ''
pod_cidr Pod CIDR network first octets (for POD_CIDR envvar) string '10.200'
tag_owner Owner Tag for all resources string 'napo.io'
tag_project Project Tag for all resources string 'k8s-the-real-hard-way-aws'
vpc_cidr AWS VPC network CIDR string '10.5.0.0/16'
zone_fqdn AWS Route53 Hosted Zone name string ''

CDK Python Tutorial

The cdk.json file tells the CDK Toolkit how to execute your app.

This project is set up like a standard Python project. The initialization process also creates a virtualenv within this project, stored under the .env directory. To create the virtualenv it assumes that there is a python3 (or python for Windows) executable in your path with access to the venv package. If for any reason the automatic creation of the virtualenv fails, you can create the virtualenv manually.

To manually create a virtualenv on MacOS and Linux:

$ python3 -m venv .env

After the init process completes and the virtualenv is created, you can use the following step to activate your virtualenv.

$ source .env/bin/activate

If you are a Windows platform, you would activate the virtualenv like this:

% .env\Scripts\activate.bat

Once the virtualenv is activated, you can install the required dependencies.

$ pip install -r requirements.txt

At this point you can now synthesize the CloudFormation template for this code.

$ cdk synth

To add additional dependencies, for example other CDK libraries, just add them to your setup.py file and rerun the pip install -r requirements.txt command.

Useful commands

  • cdk ls list all stacks in the app
  • cdk synth emits the synthesized CloudFormation template
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk docs open CDK documentation

Enjoy!

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].