Learn. Build. Secure. Automate. Accelerate with AI. Live Training • Hands-On Labs • Expert Mentorship by Coach AK Contact: +1 (469) 733-5248 | devops.coaching@gmail.com
Helm is a package manager for Kubernetes. Helm is the K8s equivalent of yum or apt. It accomplishes the same goals as Linux system package
managers like APT or YUM: managing the installation of applications and
dependencies behind the scenes and hiding the complexity from the user.
Helm helps you manage Kubernetes applications. Helm Charts helps you
define, install, and upgrade even the most complex Kubernetes
application. Charts are easy to create, version, share, and publish.
Helm is made of two components: the CLI binary named helm that allows you to perform communication with a remote component, named tiller that lives inside your Kubernetes cluster that is responsible to perform patches and changes to resources you ask to manage.
Kubernetes uses a command line utility called kubectl for communicating with
the cluster API server. It istool for controlling Kubernetes clusters. kubectl looks for a file named config in the $HOME directory.
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 manage worker nodes.
Please watch the steps in YouTube channel:
Pre-requisites:
You can use
Windows, Macbook or any Ubuntu or Red Hat EC2 instance
to setup the below tools.
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 AWS Access Keys
Once you install all of the above, you need to have AWS credentials
configured in your environment. The
aws configure
command is the fastest way to set up your AWS CLI installation for general
use.
Make sure you do not have any IAM role attached to the EC2 instance. You
can remove IAM role by going into AWS console and Detach the IAM
role.
aws configure
the AWS CLI prompts you for four pieces of information:
access key,
secret access key,
AWS Region, and
output format.
the above command should create a EKS cluster in AWS, it might take 15 to 20
mins.
The eksctl tool uses CloudFormation under the hood,
creating one stack for the EKS master control plane and another stack
for the worker nodes.
eksctl get cluster --name demo-eks --region us-east-2
This should confirm that EKS cluster is up and running.
Connect to EKS cluster
kubectl get nodes
kubectl get ns
Deploy Nginx on a Kubernetes Cluster
Let us run some apps to make sure they are deployed to Kuberneter cluster.
The below command will create deployment:
Jenkins is an Open source, Java-based automation tool. This tool
automates the Software Integration and delivery process called
Continuous Integration and Continuous Delivery.
Jenkins support various source code management, build, and delivery
tools. Jenkins is #1 Continuous integration tool, especially new
features like Jenkins Pipelines (Scripted and Declarative Pipeline)
makes the delivery process very easy and help Team to adopt DevOps
easily.
Jenkins pipeline
- Pipelines are better than freestyle jobs, you can write a lot of
complex tasks using pipelines when compared to Freestyle jobs.
- You can see how long each stage takes time to execute so you have more control compared to freestyle.
- Pipeline is groovy based script that have set of plug-ins integrated for automating the builds, deployment and test execution.
- Pipeline defines your entire build process, which typically includes
stages for building an application, testing it and then delivering it.
- You can use snippet generator to generate pipeline code for the stages you don't know how to write groovy code.
- Pipelines are two types - Scripted pipeline and Declarative pipeline
Jenkins Pipeline execution engine supports two DSL syntaxes: Scripted Pipeline and Declarative Pipeline.
Type of Jenkins Pipelines
Scripted pipeline
Declarative pipeline
Scripted pipeline
- Scripted pipeline is traditional way of writing pipeline using groovy scripting in Jenkins UI.
- stricter groovy syntax
- each stage can not be executed in parallel in multiple build agents(Slaves) that easily.
- Code is defined within a node block
- New feature added to Jenkins where you create a Jenkinsfile and check in as part of SCM such as Git.
- simpler groovy syntax
- Code is defined within a 'pipeline' block
- each stage can be executed in parallel in multiple build agents(Slaves)
Building pipelines in Azure DevOps is really easy, you can migrate your web applications from any where into Azure Cloud by using Azure pipelines. We are going to migrate Java Web App that was setup in BitBucket into Azure Cloud. Since it is a Java WebApp, we need to create a WebApp in Azure Cloud.
WebApp is a Platform as a service capability provided by Azure to deploy any kind of apps including Web apps, APIs, mobile apps.
How are we going to do?
1. Create a Webapp in Azure Cloud.
2. Create Azure pipeline in Azure DevOps
3. configure pipeline to check out code from BitBucket and deploy into Azure Cloud on WebApps
4. Run the apps
You need to create WebApp in Azure Cloud. WebApp is an App service (Platform as a Service) provided by Azure Cloud to migrate any web applications.
Once you sign in to Azure Portal, you need to create an app service which is a WebApp.
3.Click on + Add or click on Create app service(Web App)
Click on Web App. Choose your Azure subscription, usually Pay as you Go or Free trial subscription Create a new resource group(for first time if you are creating an appservice, otherwise you can use existing group)
Enter App service name(it should be unique) Publish as Code Run time stack as Java 17
Java Web Server stack --> Tomcat 10.0 Operating System as Linux Region as Central US or where ever you are based at Enter LinuxPlan name Choose SKU and size as given below: Choose DEV/Test and use 1 GB or 1.75 GB memory
Click on Apply Now click on Apply & Create This will take bit time to create the app service.
Once WebApp is created, go resources, click on WebApp name and click on the URL.
You should see the app service home page some thing like below:
Since our WebApp is up and running, now we can start creating pipelines to migrate to Azure cloud. 2. Creating pipelines in Azure Devops
1. Now go to your visual studio project page --> https://dev.azure.com/ Select the Project dashboard you already created.
Click on Pipelines, Builds.
2. Click on New pipeline and click on use the classic editor to create a pipeline without YAML
3. Select source repository as BitBucket cloud and click use user name and password to continue
4. Enter bitbucket user name and password and click on authorize.
Choose your repo by click on ... dots. click continue
5. Since our application is Java stack, type Java and Choose Azure WebApp for Java
6. Modify maven goal as clean install and also choose pom.xml by clicking on three dots ...choose pom.xml
7. Leave the value as it is for Copy Files to staging folder
8. Leave the value as it is for Publish Artifact: Drop 9. Click on Stop Azure WebApp step, Enter Azure WebApp details - where you would like to deploy your app in Azure. Select Free trial subscription from the drop down. Click on Authorize button. Make sure you disable popup blocker.
10. Do the same in Deploy Azure WebApp & Start Azure WebApp steps.
Enable Webhooks in Pipeline
11. Click on Triggers and then enable check box for Continuous Integration
12. Now click on Save and Queue
13. If your configurations are correct, you should be able to see the build success and able to access in the Azure. Click on Pipelines and pipeline name
Now you will see that Azure DevOps would have started build.
14. Make sure build is success, it should have all green like below.
After successful build, you can check the output by accessing the URL of WebApp:
https://myAzureWebAppUrl
You can watch the above steps in action in YouTube video:
Clean-up Resources:
After successfully finishing the labs, make sure to delete all the resources created in Azure portal to avoid charges from Microsoft.
Select the resource group in Azure portal, delete the resource group. This will ensure that all the resources will be deleted under the resource group.
Azure DevOps (previously known as VSTS) is Microsoft's cloud based
offering for any technology stack, any platform to turn idea into a
product. You can migrate any applications into Azure by building
pipelines in Azure Devops.
Building pipelines in Azure DevOps is really easy, you can migrate
your web application code from any where into Azure Cloud by using Azure pipelines.
Creating WebApp in Azure Cloud
You need to create WebApp in Azure Cloud. WebApp is an App service (mostly Platform as a Service) provide by Azure Cloud to migrate any web applications.
Click here to learn how to create WebApp in Azure Portal.
Creating Azure pipelines in Azure DevOps
1. Now go to your visual studio project page --> https://dev.azure.com/
Select the Project dashboard you already created.
Click on Pipelines, Builds.
2. Click on New pipeline and click on use the classic editor to create a pipeline without YAML
3. Select source repository as GitHub and click Authorize using OAuth
4. Now click on Authorize Azure Pipelines, enter GitHub password if it asks.
5. Now you should be able to select repositories by clicking ... dots
6. Since our application is Java stack, type Java and Choose Azure WebApp for Java
7. Click on pipeline name and re-name per your naming standard
8. Modify maven goal as clean install and also choose POM.xml by clicking on three dots ...
9. Leave the value as it is for Copy Files to staging folder
10. Leave the value as it is for Publish Artifact: Drop
11. Click on Stop Azure WebApp step, Enter Azure WebApp details - where you would like to deploy your app in Azure. Select Free trial subscription from the drop down.
12. Do the same in Deploy Azure WebApp & Start Azure WebApp steps.
Enable Webhooks in Pipeline
11. Click on Triggers and then enable check box for Continuous Integration
12. Now click on Save and Queue
13.
If your configurations are correct, you should be able to see the build
success and able to access in the Azure. Click on Pipelines and
pipeline name
Now you will see that Azure DevOps would have started build.
14. Make sure build is success, it should have all green like below.
After successful build, you can check the output by accessing below URL: https://myAzureWebAppUrl/MyWebApp