Skip to content

ShivakumarSwamy/udacity-k8s-infrastructure

Repository files navigation

Udacity k8s infrastructure

This project provides guide and setup scripts for udacity eks cluster

Table Of Contents

Pre-requisites

Cluster Setup

Create Cluster

You can create a cluster by using the create-eks-cluster.sh script.

Pass the cluster name, region, ssh public key and zones to the script as arguments shown below to create the cluster

# Arguments: cluster name, region, ssh public key and zones
./create-eks-cluster.sh udacity-1 us-east-1 XXXXX us-east-1a,us-east-1b

AWS Load Balancer Controller Setup

AWS Load Balancer Controller listens to ingress and service objects to create ALB and NLB respectively. More info can be found [here].(https://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/)
Please set up the ALB loadbalancer requirements as specified here

or you can use the below steps to set it up

# create ALB Controller with policy name AWSLoadBalancerControllerIAMPolicy. 
# Pleas note the arn of the policy
#Arguments: policy name
./create-iam-policy-for-aws-load-balancer-controller.sh AWSLoadBalancerControllerIAMPolicy

# create k8s serviceaccount for aws-load-balancer-controller
# Arguments: cluster name, namespace to install, name of service account, policy arn and region 
./create-serviceaccount-for-aws-load-balancer-controller.sh udacity-1 kube-system aws-load-balancer-controller \
arn:aws:iam::XXXXXXXXXX:policy/AWSLoadBalancerControllerIAMPolicy us-east-1

# Install a TargetGroupBinding custom resource definitions(CRD)
kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"

# Add eks charts repo to helm
helm repo add eks https://aws.github.io/eks-charts

# install eks/aws-load-balancer-controller chart to setup aws-load-balancer-controller in cluster
# Arguments: chart name, cluster name, name of service account, namespace to install 
./helm-setup-aws-load-balancer-controller.sh aws-load-balancer-controller udacity-1 aws-load-balancer-controller kube-system

Create a namespace

Using the kubectl command, please create your desired namespace

kubectl create namespace udacity-services

Configure circle CI aws user or role access to cluster

Please refer to the guide here on how to set it up.

Example k8s config map yaml can be found below

apiVersion: v1
data:
  mapRoles: |
    - groups:
      - system:bootstrappers
      - system:nodes
      rolearn: arn:aws:iam::XXXXXXXXXXX:role/ZZZZZZZZZZ
      username: system:node:{{EC2PrivateDNSName}}
  mapUsers: |
    - userarn: arn:aws:iam::XXXXXXXXXXX:user/YYYYYYYYY
      username: YYYYYYYYY
      groups:
        - system:masters
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system

About

Guide and setup scripts for udacity eks cluster

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages