forked from iam-veeramalla/aws-devops-zero-to-hero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b035be5
commit 29aa800
Showing
6 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 2048 App | ||
|
||
## Create Fargate profile | ||
|
||
``` | ||
eksctl create fargateprofile \ | ||
--cluster demo-cluster \ | ||
--region us-east-1 \ | ||
--name alb-sample-app \ | ||
--namespace game-2048 | ||
``` | ||
|
||
## Deploy the deployment, service and Ingress | ||
|
||
``` | ||
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/examples/2048/2048_full.yaml | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# How to setup alb add on | ||
|
||
Download IAM policy | ||
|
||
``` | ||
curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.5.4/docs/install/iam_policy.json | ||
``` | ||
|
||
Create IAM Policy | ||
|
||
``` | ||
aws iam create-policy \ | ||
--policy-name AWSLoadBalancerControllerIAMPolicy \ | ||
--policy-document file://iam_policy.json | ||
``` | ||
|
||
Create IAM Role | ||
|
||
``` | ||
eksctl create iamserviceaccount \ | ||
--cluster=<your-cluster-name> \ | ||
--namespace=kube-system \ | ||
--name=aws-load-balancer-controller \ | ||
--role-name AmazonEKSLoadBalancerControllerRole \ | ||
--attach-policy-arn=arn:aws:iam::<your-aws-account-id>:policy/AWSLoadBalancerControllerIAMPolicy \ | ||
--approve | ||
``` | ||
|
||
## Deploy ALB controller | ||
|
||
Add helm repo | ||
|
||
``` | ||
helm repo add eks https://aws.github.io/eks-charts | ||
``` | ||
|
||
Update the repo | ||
|
||
``` | ||
helm repo update eks | ||
``` | ||
|
||
Install | ||
|
||
``` | ||
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \ | ||
-n kube-system \ | ||
--set clusterName=<your-cluster-name> \ | ||
--set serviceAccount.create=false \ | ||
--set serviceAccount.name=aws-load-balancer-controller \ | ||
--set region=<region> \ | ||
--set vpcId=<your-vpc-id> | ||
``` | ||
|
||
Verify that the deployments are running. | ||
|
||
``` | ||
kubectl get deployment -n kube-system aws-load-balancer-controller | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# commands to configure IAM OIDC provider | ||
|
||
``` | ||
export cluster_name=demo-cluster | ||
``` | ||
|
||
``` | ||
oidc_id=$(aws eks describe-cluster --name $cluster_name --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 5) | ||
``` | ||
|
||
## Check if there is an IAM OIDC provider configured already | ||
|
||
- aws iam list-open-id-connect-providers | grep $oidc_id | cut -d "/" -f4\n | ||
|
||
If not, run the below command | ||
|
||
``` | ||
eksctl utils associate-iam-oidc-provider --cluster $cluster_name --approve | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Install EKS | ||
|
||
Please follow the prerequisites doc before this. | ||
|
||
## Install using Fargate | ||
|
||
``` | ||
eksctl create cluster --name demo-cluster --region us-east-1 --fargate | ||
``` | ||
|
||
## Delete the cluster | ||
|
||
``` | ||
eksctl delete cluster --name demo-cluster --region us-east-1 | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# prerequisites | ||
|
||
kubectl – A command line tool for working with Kubernetes clusters. For more information, see [Installing or updating kubectl]("https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html"). | ||
|
||
eksctl – A command line tool for working with EKS clusters that automates many individual tasks. For more information, see [Installing or updating]("https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html"). | ||
|
||
AWS CLI – A command line tool for working with AWS services, including Amazon EKS. For more information, see [Installing, updating, and uninstalling the AWS CLI]("https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html") in the AWS Command Line Interface User Guide. After installing the AWS CLI, we recommend that you also configure it. For more information, see [Quick configuration]("https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config") with aws configure in the AWS Command Line Interface User Guide. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Sample App deployment | ||
|
||
## Copy the deploy.yml to your local and save it with name deploy.yml | ||
|
||
``` | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: eks-sample-linux-deployment | ||
labels: | ||
app: eks-sample-linux-app | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: eks-sample-linux-app | ||
template: | ||
metadata: | ||
labels: | ||
app: eks-sample-linux-app | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/arch | ||
operator: In | ||
values: | ||
- amd64 | ||
- arm64 | ||
containers: | ||
- name: nginx | ||
image: public.ecr.aws/nginx/nginx:1.23 | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
imagePullPolicy: IfNotPresent | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
``` | ||
|
||
## Deploy the app | ||
|
||
``` | ||
kubectl apply -f deploy.yaml | ||
``` | ||
|
||
|
||
## Copy the below file as service.yml | ||
|
||
``` | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: eks-sample-linux-service | ||
labels: | ||
app: eks-sample-linux-app | ||
spec: | ||
selector: | ||
app: eks-sample-linux-app | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 80 | ||
``` | ||
|
||
## Deploy the service | ||
|
||
``` | ||
kubectl apply -f service.yaml | ||
``` |