SlideShare a Scribd company logo
Building a Kubernetes App with
Amazon EKS
Laura Frank Tacho
Director of Engineering, CloudBees
@rhein_wein
We’ll Cover:
• What Amazon EKS is, and how it differs from other Kubernetes
offerings
• Requirements for running an EKS cluster
• Automating app deployment to EKS with CodeShip, a CI/CD tool
• CI/CD best practices
EKS is a managed
Kubernetes offering
from AWS
CloudBees CodeShip is a
customizable CI/CD engine
designed with containerized
applications in mind
Kubernetes provides a shared standard for declaring application
configuration, making your containerized apps portable.
Local Environments
Minikube
Docker for Mac
Docker for Windows
play-with-k8s.com
Managed Kubernetes platforms
offered by cloud providers
GKE, AKS, EKS
Cloud agnostic* managed Kubernetes
Rancher Kubernetes Engine
Docker Enterprise Edition
Joyent Triton
RedHat OpenShift
CoreOS Tectonic (now part of RedHat)
landscape.cncf.io
Managed, not magic
AWS docs are great, but not everything is done
for you
Prerequisites:
- Basic understanding of IAM
- Able to use provided templates with
CloudFormation
- Understanding of EC2 resource types
AWS CLI skills not necessary, but helpful
Basic understanding of kubectl is necessary
An Even Quicker Quickstart Guide
Create your Amazon EKS service role in the IAM console
Create a VPC to use with your cluster. You can use a provided CloudFormation
template for this. Note that EKS is only available in us-west-2 and us-east-1.
Install kubectl and aws-iam-authenticator for local access
Create your EKS cluster either via the GUI or the CLI
Configure access to your cluster locally
Launch worker nodes via CloudFormation
1
2
3
4
5
6
EKS + Terraform
You can stand up your cluster using Terraform
Guide is available at
https://www.terraform.io/docs/providers/aws/guides/eks-getting-started.html
Deploying a Kubernetes App with Amazon EKS
Sample App: Cats vs Dogs
vote result
worker dbredis
worker
.NET
vote
python
redis
redis
db
postgres
result
node-js
Service Architecture
worker
.NET
vote
python
redis
redis
db
postgres
result
node-js
Use from DockerHub
Test, create, and push images with CodeShip, then deploy to EKS cluster
you must set up a storage
class to use persistent
volume claims; they are not
configured automatically
with EKS
Switching Between Local Dev and EKS
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
aws kubernetes aws
$ echo $KUBECONFIG
/Users/laura/.kube/config-demo
$ export KUBECONFIG=$KUBECONFIG:/Users/laura/.kube/config-docker4mac
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* aws kubernetes aws
docker-for-desktop docker-for-desktop-cluster docker-for-desktop
see all available contexts
add another config file to KUBECONFIG path
new context has been added
...Or Just Update KUBECONFIG
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
aws kubernetes aws
$ echo $KUBECONFIG
/Users/laura/.kube/config-demo
$ export KUBECONFIG=/Users/laura/.kube/config-docker4mac
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
docker-for-desktop docker-for-desktop-cluster docker-for-desktop
see all available contexts
update KUBECONFIG to only see one config file
only one context!
Deploying a Kubernetes App with Amazon EKS
1. Make a change locally
2. Run tests locally
3. Push to GitHub & trigger a build on CodeShip
4. Build the updated images
5. Run tests against new code
6. Push new images to registry (Docker Hub)
7. Green build? Merge to master!
8. Use CodeShip to trigger a deployment on EKS
9. Finally see our changes in prod!
Updating our Application
1. Make a change locally
2. Run tests locally
3. Push to GitHub & trigger a build on CodeShip
4. Build the updated images
5. Run tests against new code
6. Push new images to registry (Docker Hub)
7. Green build? Merge to master!
8. Use CodeShip to trigger a deployment on EKS
9. Finally see our changes in prod!
Updating our Application
Automate with CodeShip
Accessing your EKS Cluster from CodeShip
Prerequisites
- AWS account and credentials
- kubectl installed and configured locally
- The Jet CLI installed locally (bit.ly/codeship-jet-tool)
AWS access keys + kubeconfig allow you to access your EKS cluster from a CodeShip build.
EKS uses IAM credentials to authenticate to your cluster.
The aws-iam-authenticator was previously called heptio-authenticator-aws
Accessing your EKS Cluster from CodeShip
Set up access to your cluster as described in the AWS EKS docs. Then flatten your kubeconfig and
add it to your environment file. Use the Jet CLI and your project’s AES key to encrypt the env file.
AWS_ACCESS_KEY_ID=your_access_key_id
AWS_SECRET_ACCESS_KEY=your_secret_access_key
eks-env
kubectl config current-context #make sure it’s aws
kubectl config view --minify --flatten > kubeconfigdata
docker run --rm -it -v $(pwd):/files codeship/env-var-helper cp 
kubeconfigdata:/root/.kube/config k8s-env
cat k8s-env >> eks-env
jet encrypt eks-env eks-env.encrypted
rm kubeconfigdata k8s-env eks-env #or add them to your .gitignore
Accessing your EKS Cluster from CodeShip
[...]
kubectl:
image: codeship/eks-kubectl
encrypted_env_file: eks-env.encrypted
volumes:
- ./deploy:/deploy
[...]
- name: eks_deployment
service: kubectl
tag: master
command: ./deploy/eks-deployment.sh
codeship-services.yml codeship-steps.yml
This image has AWS-vendored kubectl,
aws-iam-authenticator, and a helper script to pull the
kubeconfig out of the encrypted environment variable
and put it into /.kube/kubeconfig.
This step is only run on builds from the master branch,
and will run the EKS deploy script that is mounted into
the container.
Deploying to EKS
CodeShip Build
EKS Cluster
magic?
Deploying to EKS
Managed, not magic
EKS is concerned with infrastructure, and doesn’t replace existing deployment patterns
You still need to:
1. Package your application code in container images
2. Push the images to a registry for distribution
3. Issue commands to update your cluster
4. Deal with extra requirements like storage classes, etc
Good news: using EKS doesn’t lock you in to ECR (AWS’s image registry), though it may be slightly easier to use
because of shared credentials and roles
Deploying to EKS
- type: push
service: worker
name: push_worker_image
image_name: rheinwein/examplevotingapp-worker
image_tag: "{{.CommitID}}"
Build images with CodeShip and push to a registry
using CodeShip’s push step type.
codeship-steps.yml
Best Practice for Containerized Apps
Tag your images with versions or the commit SHA. Avoid pulling images using the latest tag.
- name: eks_deployment
service: kubectl
tag: master
command: ./deploy/eks-deployment.sh
codeship-steps.yml
Use a deploy script to issue update commands
against your EKS cluster.
1 2
Deploying to EKS
CodeShip Build
EKS Cluster
magic?
Deploying to EKS
Image
Registry
EKS Cluster
CodeShip Build
GitHub
check out source code
report testing & build status
push images
build & tag images
issue update/deployment commands
pull images
Monitoring,
Observing,
Alerting
Deploying a Kubernetes App with Amazon EKS
CI/CD Tips and Best Practices
Healthchecks
A running container only
means that the process is
running, not that the service
is available. CodeShip
respects the HEALTHCHECK
attribute of services, and will
wait until the service is
available before trying to use
it in a build.
Encryption
CodeShip provides each
project with an AES key to
encrypt secrets. Using the
CodeShip CLI jet, you can
encrypt and decrypt
environment variables.
Manual Approval
Want an extra set of eyes on
changes before they’re
deployed, or want to restrict
deployments to certain
groups of people? With
manual steps, you have more
control over your CD process.
Sign up for CodeShip
https://codeship.com
AWS EKS Getting Started Guide
https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html
Download a local Kubernetes environment with Docker for Mac or Windows
https://www.docker.com/products/docker-desktop
Example-voting-app source code
https://github.com/rheinwein/example-voting-app
Download Deploying to Kubernetes Codeship eBook
https://resources.codeship.com/ebook/deploy-docker-kubernetes-codeship
Useful Links
Interested in learning more about DevOps best practices and use cases?
Join us for Jenkins World | DevOps World
San Francisco, California
September 16-19, 2018
Nice, France
October 22-25, 2018
Get 20% off with code JWLTACHO
Thank you!
Slides: bit.ly/eks-codeship

More Related Content

PDF
Using Docker For Development
PDF
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
PDF
ECS and ECR deep dive
PDF
Containers and security
PDF
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
PDF
New AWS Services
PDF
docker-machine, docker-compose, docker-swarm 覚書
PDF
Running your Java EE 6 applications in the Cloud (FISL 12)
Using Docker For Development
[AWS Dev Day] 앱 현대화 | AWS Fargate를 사용한 서버리스 컨테이너 활용 하기 - 삼성전자 개발자 포털 사례 - 정영준...
ECS and ECR deep dive
Containers and security
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
New AWS Services
docker-machine, docker-compose, docker-swarm 覚書
Running your Java EE 6 applications in the Cloud (FISL 12)

What's hot (11)

PDF
Fargate 를 이용한 ECS with VPC 1부
PPTX
Best Practices with Azure & Kubernetes
PDF
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
PDF
Kubernetes best practices
PDF
Autoscaling Kubernetes
PDF
Installing WordPress on AWS
PPTX
Deploying your web application with AWS ElasticBeanstalk
PPTX
Why Kubernetes on Azure
PPTX
Continuous delivery and deployment on AWS
PDF
AWS + Puppet = Dynamic Scale
PDF
Infrastructure as code
Fargate 를 이용한 ECS with VPC 1부
Best Practices with Azure & Kubernetes
Containers Meetup (AWS+CNCF) Milano Jan 15th 2020
Kubernetes best practices
Autoscaling Kubernetes
Installing WordPress on AWS
Deploying your web application with AWS ElasticBeanstalk
Why Kubernetes on Azure
Continuous delivery and deployment on AWS
AWS + Puppet = Dynamic Scale
Infrastructure as code
Ad

Similar to Deploying a Kubernetes App with Amazon EKS (20)

PDF
What Is AWS Elastic Kubernetes Service
PDF
Aws container webinar day 1
PDF
AWS Community Day - Andrew May - Running Containers in AWS
PDF
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
PPTX
2016 Docker Palo Alto - CD with ECS and Jenkins
PDF
Kubernetes
PDF
Building Deploying and Managing Microservices-based Applications with Azure P...
PPTX
Amazon EKS Deep Dive
PDF
Dockerized .Net Core based app services in azure K8s
PPTX
From 0 to 60 with kubernetes and istio
PDF
From Docker Straight to AWS
PPTX
Bitbucket Pipelines - Powered by Kubernetes
PDF
Pro2516 10 things about oracle and k8s.pptx-final
PPTX
Kubernetes-Fundamentals.pptx
PDF
Best Practices with Azure Kubernetes Services
PPTX
Microservices with containers in the cloud
PPTX
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
PDF
Docker clusters on AWS with Amazon ECS and Kubernetes
PPTX
Containers and Kubernetes
PPTX
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
What Is AWS Elastic Kubernetes Service
Aws container webinar day 1
AWS Community Day - Andrew May - Running Containers in AWS
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
2016 Docker Palo Alto - CD with ECS and Jenkins
Kubernetes
Building Deploying and Managing Microservices-based Applications with Azure P...
Amazon EKS Deep Dive
Dockerized .Net Core based app services in azure K8s
From 0 to 60 with kubernetes and istio
From Docker Straight to AWS
Bitbucket Pipelines - Powered by Kubernetes
Pro2516 10 things about oracle and k8s.pptx-final
Kubernetes-Fundamentals.pptx
Best Practices with Azure Kubernetes Services
Microservices with containers in the cloud
Weaveworks at AWS re:Invent 2016: Operations Management with Amazon ECS
Docker clusters on AWS with Amazon ECS and Kubernetes
Containers and Kubernetes
kubeadm Cluster Creation Internals_ From Self-Hosting to Upgradability and HA...
Ad

More from Laura Frank Tacho (9)

PDF
The Container Shame Spiral
PDF
Scalable and Available Services with Docker and Kubernetes
PDF
SwarmKit in Theory and Practice
PDF
Everything You Thought You Already Knew About Orchestration
PDF
Building Efficient Parallel Testing Platforms with Docker
PDF
Efficient Parallel Testing with Docker
PDF
Stop Being Lazy and Test Your Software
PDF
Happier Teams Through Tools
PDF
Rails Applications with Docker
The Container Shame Spiral
Scalable and Available Services with Docker and Kubernetes
SwarmKit in Theory and Practice
Everything You Thought You Already Knew About Orchestration
Building Efficient Parallel Testing Platforms with Docker
Efficient Parallel Testing with Docker
Stop Being Lazy and Test Your Software
Happier Teams Through Tools
Rails Applications with Docker

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Introduction to Artificial Intelligence
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
AI in Product Development-omnex systems
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Online Work Permit System for Fast Permit Processing
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
System and Network Administration Chapter 2
Odoo Companies in India – Driving Business Transformation.pdf
Softaken Excel to vCard Converter Software.pdf
Introduction to Artificial Intelligence
How Creative Agencies Leverage Project Management Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Odoo POS Development Services by CandidRoot Solutions
AI in Product Development-omnex systems
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Which alternative to Crystal Reports is best for small or large businesses.pdf
Design an Analysis of Algorithms II-SECS-1021-03
ManageIQ - Sprint 268 Review - Slide Deck
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Upgrade and Innovation Strategies for SAP ERP Customers
Understanding Forklifts - TECH EHS Solution
Online Work Permit System for Fast Permit Processing
How to Choose the Right IT Partner for Your Business in Malaysia
System and Network Administration Chapter 2

Deploying a Kubernetes App with Amazon EKS

  • 1. Building a Kubernetes App with Amazon EKS Laura Frank Tacho Director of Engineering, CloudBees @rhein_wein
  • 2. We’ll Cover: • What Amazon EKS is, and how it differs from other Kubernetes offerings • Requirements for running an EKS cluster • Automating app deployment to EKS with CodeShip, a CI/CD tool • CI/CD best practices
  • 3. EKS is a managed Kubernetes offering from AWS CloudBees CodeShip is a customizable CI/CD engine designed with containerized applications in mind
  • 4. Kubernetes provides a shared standard for declaring application configuration, making your containerized apps portable. Local Environments Minikube Docker for Mac Docker for Windows play-with-k8s.com Managed Kubernetes platforms offered by cloud providers GKE, AKS, EKS Cloud agnostic* managed Kubernetes Rancher Kubernetes Engine Docker Enterprise Edition Joyent Triton RedHat OpenShift CoreOS Tectonic (now part of RedHat)
  • 6. Managed, not magic AWS docs are great, but not everything is done for you Prerequisites: - Basic understanding of IAM - Able to use provided templates with CloudFormation - Understanding of EC2 resource types AWS CLI skills not necessary, but helpful Basic understanding of kubectl is necessary
  • 7. An Even Quicker Quickstart Guide Create your Amazon EKS service role in the IAM console Create a VPC to use with your cluster. You can use a provided CloudFormation template for this. Note that EKS is only available in us-west-2 and us-east-1. Install kubectl and aws-iam-authenticator for local access Create your EKS cluster either via the GUI or the CLI Configure access to your cluster locally Launch worker nodes via CloudFormation 1 2 3 4 5 6
  • 8. EKS + Terraform You can stand up your cluster using Terraform Guide is available at https://www.terraform.io/docs/providers/aws/guides/eks-getting-started.html
  • 10. Sample App: Cats vs Dogs vote result worker dbredis
  • 12. worker .NET vote python redis redis db postgres result node-js Use from DockerHub Test, create, and push images with CodeShip, then deploy to EKS cluster you must set up a storage class to use persistent volume claims; they are not configured automatically with EKS
  • 13. Switching Between Local Dev and EKS $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE aws kubernetes aws $ echo $KUBECONFIG /Users/laura/.kube/config-demo $ export KUBECONFIG=$KUBECONFIG:/Users/laura/.kube/config-docker4mac $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE * aws kubernetes aws docker-for-desktop docker-for-desktop-cluster docker-for-desktop see all available contexts add another config file to KUBECONFIG path new context has been added
  • 14. ...Or Just Update KUBECONFIG $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE aws kubernetes aws $ echo $KUBECONFIG /Users/laura/.kube/config-demo $ export KUBECONFIG=/Users/laura/.kube/config-docker4mac $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE docker-for-desktop docker-for-desktop-cluster docker-for-desktop see all available contexts update KUBECONFIG to only see one config file only one context!
  • 16. 1. Make a change locally 2. Run tests locally 3. Push to GitHub & trigger a build on CodeShip 4. Build the updated images 5. Run tests against new code 6. Push new images to registry (Docker Hub) 7. Green build? Merge to master! 8. Use CodeShip to trigger a deployment on EKS 9. Finally see our changes in prod! Updating our Application
  • 17. 1. Make a change locally 2. Run tests locally 3. Push to GitHub & trigger a build on CodeShip 4. Build the updated images 5. Run tests against new code 6. Push new images to registry (Docker Hub) 7. Green build? Merge to master! 8. Use CodeShip to trigger a deployment on EKS 9. Finally see our changes in prod! Updating our Application Automate with CodeShip
  • 18. Accessing your EKS Cluster from CodeShip Prerequisites - AWS account and credentials - kubectl installed and configured locally - The Jet CLI installed locally (bit.ly/codeship-jet-tool) AWS access keys + kubeconfig allow you to access your EKS cluster from a CodeShip build. EKS uses IAM credentials to authenticate to your cluster. The aws-iam-authenticator was previously called heptio-authenticator-aws
  • 19. Accessing your EKS Cluster from CodeShip Set up access to your cluster as described in the AWS EKS docs. Then flatten your kubeconfig and add it to your environment file. Use the Jet CLI and your project’s AES key to encrypt the env file. AWS_ACCESS_KEY_ID=your_access_key_id AWS_SECRET_ACCESS_KEY=your_secret_access_key eks-env kubectl config current-context #make sure it’s aws kubectl config view --minify --flatten > kubeconfigdata docker run --rm -it -v $(pwd):/files codeship/env-var-helper cp kubeconfigdata:/root/.kube/config k8s-env cat k8s-env >> eks-env jet encrypt eks-env eks-env.encrypted rm kubeconfigdata k8s-env eks-env #or add them to your .gitignore
  • 20. Accessing your EKS Cluster from CodeShip [...] kubectl: image: codeship/eks-kubectl encrypted_env_file: eks-env.encrypted volumes: - ./deploy:/deploy [...] - name: eks_deployment service: kubectl tag: master command: ./deploy/eks-deployment.sh codeship-services.yml codeship-steps.yml This image has AWS-vendored kubectl, aws-iam-authenticator, and a helper script to pull the kubeconfig out of the encrypted environment variable and put it into /.kube/kubeconfig. This step is only run on builds from the master branch, and will run the EKS deploy script that is mounted into the container.
  • 21. Deploying to EKS CodeShip Build EKS Cluster magic?
  • 22. Deploying to EKS Managed, not magic EKS is concerned with infrastructure, and doesn’t replace existing deployment patterns You still need to: 1. Package your application code in container images 2. Push the images to a registry for distribution 3. Issue commands to update your cluster 4. Deal with extra requirements like storage classes, etc Good news: using EKS doesn’t lock you in to ECR (AWS’s image registry), though it may be slightly easier to use because of shared credentials and roles
  • 23. Deploying to EKS - type: push service: worker name: push_worker_image image_name: rheinwein/examplevotingapp-worker image_tag: "{{.CommitID}}" Build images with CodeShip and push to a registry using CodeShip’s push step type. codeship-steps.yml Best Practice for Containerized Apps Tag your images with versions or the commit SHA. Avoid pulling images using the latest tag. - name: eks_deployment service: kubectl tag: master command: ./deploy/eks-deployment.sh codeship-steps.yml Use a deploy script to issue update commands against your EKS cluster. 1 2
  • 24. Deploying to EKS CodeShip Build EKS Cluster magic?
  • 25. Deploying to EKS Image Registry EKS Cluster CodeShip Build GitHub check out source code report testing & build status push images build & tag images issue update/deployment commands pull images Monitoring, Observing, Alerting
  • 27. CI/CD Tips and Best Practices Healthchecks A running container only means that the process is running, not that the service is available. CodeShip respects the HEALTHCHECK attribute of services, and will wait until the service is available before trying to use it in a build. Encryption CodeShip provides each project with an AES key to encrypt secrets. Using the CodeShip CLI jet, you can encrypt and decrypt environment variables. Manual Approval Want an extra set of eyes on changes before they’re deployed, or want to restrict deployments to certain groups of people? With manual steps, you have more control over your CD process.
  • 28. Sign up for CodeShip https://codeship.com AWS EKS Getting Started Guide https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html Download a local Kubernetes environment with Docker for Mac or Windows https://www.docker.com/products/docker-desktop Example-voting-app source code https://github.com/rheinwein/example-voting-app Download Deploying to Kubernetes Codeship eBook https://resources.codeship.com/ebook/deploy-docker-kubernetes-codeship Useful Links
  • 29. Interested in learning more about DevOps best practices and use cases? Join us for Jenkins World | DevOps World San Francisco, California September 16-19, 2018 Nice, France October 22-25, 2018 Get 20% off with code JWLTACHO