Skip to content

Example of how to run an app in EKS with CRPM

License

Notifications You must be signed in to change notification settings

shi-archive/crpm-eks-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example Application

Deploy an example app with CI/CD in an existing EKS cluster.

Deploy Stack

npm uninstall -g cdk
npm i -g aws-cdk crpm typescript

# Clone the infrastructure code
git clone https://github.com/mscribe/crpm-eks-app

# Change directory
cd crpm-eks-app/infra
npm i

# Deploy the application CI/CD, which deploys the application
# Replace the first ? with the management role ARN used to
# deploy EKS and the second ? with the EKS cluster name
cdk deploy cicd \
    --parameters EksRoleArn=? \
    --parameters ClusterName=?

Allow CodeBuild to Assume EKS Role

CodeBuild will need to assume the existing EKS role in order to deploy the application. So, you will need to edit the trust relationship so that the CodeBuild role ARN is allowed to assume the EKS role.

  1. In the AWS Console, navigate to IAM -> Roles.
  2. Search for the existing EKS role that was used to create the EKS cluster initially, and open the role.
  3. Click the Trust Relationships tab.
  4. Click the Edit trust relationship button.
  5. Add the following statement into the Statement list in the Policy Document, replacing the ? below with the ARN of your IAM role used by the CodeBuild project created for deploying the application. The CodeBuild Role ARN can be seen in the Outputs after deploying cicd.
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "?"
      },
      "Action": "sts:AssumeRole"
    }
  1. Click the Update Trust Policy button.

Now, the KubectlApply action in the Deploy stage of CodePipeline should be able to execute successfully.

Destroy Stack

# Delete the deployment and service
kubectl delete deployment app
kubectl delete svc app

# Destroy the CI/CD pipeline
cdk destroy cicd

About

Example of how to run an app in EKS with CRPM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published