Posts

Showing posts from May, 2023

Creating Amazon EKS cluster by eksctl

Image
What is Amazon EKS Amazon EKS is a fully managed container orchestration service. EKS allows you to quickly deploy a production ready Kubernetes cluster in AWS, deploy and manage containerized applications more easily with a fully managed Kubernetes service. EKS takes care of master node/control plane. We need to create worker nodes. EKS cluster can be created in following ways: 1. AWS console 2. AWS CLI 3. eksctl command 4. using Terraform We will create EKS cluster using eksctl command line tool. Pre-requisites: This Lab is using Jenkins EC2 instance. Jenkins EC2 instance needs to have following configured: Install AWS CLI   – Command line tools for working with AWS services, including Amazon EKS. Install eksctl   –  A command line tool for working with EKS clusters that automates many individual tasks. Install kubectl    – A command line tool for working with Kubernetes clusters.  Create IAM Role with Administrator Access You need to create an IAM role with  AdministratorAccess  pol

Automate Docker builds using Jenkins - Dockerize PHP App

Image
We will learn how to automate Docker builds using Jenkins. We will use PHP based application. I have already created a repo with source code + Dockerfile. The repo also have Jenkinsfile for automating the following: - Automating builds - Automating Docker image creation - Automating Docker image upload - Automating Docker container provisioning Pre-requisites: 1. Jenkins is up and running 2. Docker installed on Jenkins instance 3. Docker pipeline and Docker pipeline plug-ins are installed in Jenkins 4. user account setup in  https://cloud.docker.com 5. Port 8086 open in security firewall rules Step #1 - Create Credentials for Docker Hub Go to your Jenkins where you have installed Docker as well. Go to credentials --> Click on Global credentials Click on Add Credentials Now Create an entry for Docker Hub credentials Make sure you take note of the ID as circled below: Step # 2 - Create a scripted pipeline in Jenkins, name can be anything Step # 3 - Copy the pipeline code from below Ma

Automate Docker builds using Jenkins Pipelines

Image
Dockerize Python App | Upload Docker Images into AWS ECR We will learn how to automate Docker builds using Jenkins. We will use Python based application. I have already created a repo with source code + Dockerfile. We will see how to create Docker image and upload into AWS ECR successfully. We will not be using AWS access keys to upload image into ECR, we will be using IAM role and attach to Jenkins instance to access ECR. - Automating builds - Automating Docker image builds - Automating Docker image upload into AWS ECR - Automating Docker container provisioning   Pre-requisites: 1. Jenkins is up and running 2. Docker installed on Jenkins instance. 3. Docker and Docker pipelines plug-in are installed 4. Repo created in ECR 5.  Make sure port 8096  is opened up in firewall rules.  6. Create an IAM role with  AmazonEC2ContainerRegistryFullAccess  policy, attach role to Jenkins EC2 instance 7. Make sure  AWS cli  is installed in Jenkins instance. Code for this video is here: Make sure you

How to automate Docker Images creation using Jenkins

Image
Every time developer makes code changes, you would want to Jenkins to automate Docker images creation and pushing into Docker registry. Let us see how to do this. Pre-requisites: Jenkins is up and running Docker is installed in Jenkins machine. Docker plug-in installed in Jenkins. Docker pipeline plug-in installed in Jenkins. Steps: Now Login to Jenkins EC2 instance, execute below commands: Add jenkins user to Docker group sudo usermod -a -G docker jenkins Restart Jenkins service sudo service jenkins restart Reload system daemon files sudo systemctl daemon-reload Restart Docker service as well sudo service docker stop sudo service docker start

How to setup Elastic Container Registry (ECR) for Docker on AWS

Image
Amazon ECR uses Amazon S3 for storage to make your container images highly available and accessible, allowing you to reliably deploy new containers for your applications. Amazon ECR transfers your container images over HTTPS and automatically encrypts your images at rest. Amazon ECR is integrated with Amazon Elastic Container Service (ECS), simplifying your development to production workflow. What are we going to do in this lab? 1. Create a Repository in AWS ECR 2. Create an IAM role with ContainerRegistryFullAccess 3. Attach the IAM role to EC2 instance 4. Download pythonApp from  Bitbucket 5. Build docker image for the Python App 6. Tag docker image 7. Login to AWS ECR using aws cli  8. Push docker image into ECR 9. Run python app in Docker container Create a repo in ECR  Go to AWS console and search for ECR Click on Create  Repository Enter name for your repo - all lower case and  Click create repository Once repo is created, choose the repo and click on view push commands. Note dow