Skip to content

Instantly share code, notes, and snippets.

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "2.6.0"
name = var.cluster_name
cidr = "10.2.0.0/16"
azs = data.aws_availability_zones.available.names
private_subnets = ["10.2.0.0/20", "10.2.16.0/20", "10.2.32.0/20"]
public_subnets = ["10.2.48.0/20", "10.2.64.0/20", "10.2.80.0/20"]
enable_dns_hostnames = true
worker_groups_launch_template = [
{
name = "spot-1"
# override_instance_types = ["m5.large", "m5a.large", "m5d.large", "m5ad.large"]
override_instance_types = ["t3a.medium", "t3.medium"]
spot_instance_pools = 2
asg_max_size = 3
asg_desired_capacity = 1
kubelet_extra_args = "--node-labels=node.kubernetes.io/lifecycle=spot"
public_ip = true
terraform {
backend "s3" {
bucket = "{{CLUSTER_NAME}}"
key = "terraform.tfstate"
region = "{{REGION}}"
# dynamodb_table = "test-eks-spot-locks"
encrypt = true
}
}
# taken and adapted from here to get it working:
# https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/autoscaling.md
resource "aws_iam_role_policy_attachment" "workers_autoscaling" {
policy_arn = aws_iam_policy.worker_autoscaling.arn
role = module.eks.worker_iam_role_name
}
resource "aws_iam_policy" "worker_autoscaling" {
name_prefix = "ClusterAutoScalingPolicy-${var.cluster_name}"
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: deploy-application
spec:
inputs:
resources:
- name: git-source
type: git
params:
apiVersion: tekton.dev/v1alpha1
# apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-image-from-source
spec:
inputs:
resources:
- name: git-source
type: git
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: git
spec:
type: git
params:
- name: revision
value: master
- name: url
replicaCount: 2
image:
repository: kubernautslabs/hello-helm
tag: latest
pullSecret: regsecret
pullPolicy: Always
#pullPolicy: Never
service:
name: hello-service
type: LoadBalancer
variable "client_id" {}
variable "client_secret" {}
variable "agent_count" {
default = 1
}
variable "ssh_public_key" {
default = "~/.ssh/id_rsa.pub"
#!/usr/bin/env bash
# by casey siens
#RUN THIS AS ROOT. YOU MUST BE ABLE TO SSH TO EACH NODE AS ROOT! IGNORE THE RED WARNINGS WHEN THE SERVICES START DURING THE INSTALL!!! ALLOW THE SCRIPT TO FINISH!!!
#List of master node ips.
ha_master_ip_list="10.9.8.21 10.9.8.22 10.9.8.23"
#VIP for ha.
ha_vip="10.9.8.20"