https://www.coachdevops.com/2020/03/how-to-create-jenkinsfile-how-to.html
////////////////
https://bitbucket.org/rohit17jan17jan/myawesomeangularapprepo/src/master/
//////////////////////////////////////////////////////////////////////////////////////////
https://www.coachdevops.com/2019/01/pre-requisites-before-starting-devops.html
Monday, January 14, 2019
Pre-requisites before starting the DevOps Coaching
1. Create an account in https://aws.amazon.com. Set that as basic free tier account (personal account). role as developer or anything. You need to enter credit card info. But that’s fine, they won’t charge you except $1.
Sign up free account.
Select Basic Plan..Do NOT select developer plan unless you would like to pay every month.
2. Create an account in https://www.bitbucket.org and https://github.com/
Sign up using your email.
3. Start learning Linux Basics
Click on download, once downloaded. Go to downloads directory and click on the EXE.
Choose all options by default by clicking on Next and NExt
6. Only if you are using Macbook pro or iMac desktop, please download iTerm from https://www.iterm2.com/downloads.html. for windows laptop, ignore this step.
Download the iTerm2**.zip file and install iTerm on Mac.
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
https://www.coachdevops.com/2019/02/create-ec2-instance-how-to-create-ec2.html
Saturday, February 9, 2019
Create EC2 Instance - How to create EC2 instance in AWS console
Steps:
7. Click create new security group, give name as MyJenkinsSecurityGroup, add custom rule for 8080, 8090 , allow 0.0.0.0/0 as source IP8. Click on Review and launchClick on Launch09. Choose the existing key pair if you have one, otherwise create new one, give some name as my2020EC2Key. Make sure you download the key. Please do not give any space or any character in naming the key.
Once instance is created. you can see it running..Please click the below link to understand the steps for connecting to EC2 instance from your local machine - windows or Apple laptop.
How to connect to EC2 using Git bash or ITerm in Mac?
http://www.cidevops.com/2018/0
1. go to Downloaded location private key in your local machine.
2. Copy the url from Ec2 console by selecting the instance, click on actions, connect. Please use the above link to connect to EC2 from your local machine.
Watch here for live demo:
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////
//////////////
https://www.youtube.com/watch?v=f0Rbk1iVhnc&list=PLJwvtUqYDmA77rUJ3a_SQgeNpzQka-NGU
Sunday, March 8, 2020
How to create Jenkinsfile | How to configure Declarative Pipeline | create Jenkins Pipeline As code
Pre-requistes:
1. Project setup in Bitbucket/GitHub/GitLab
2. Jenkins and Tomcat (web container) set up.
3. Maven installed in Jenkins
4. Sonarqube setup and integrated with Jenkins
5. Nexus configured and integrated with Jenkins
6. Slack channel configured an integrated with Jenkins
Create Jenkinsfile (pipeline code) to your MyWebApp
Step 1
Go to GitHub and choose the Repo where you setup MyWebApp in Lab exercise # 2
Step 2
Click on create new file.
Step 3 - Enter Jenkinsfile as a file name
Step 4
Copy and paste the below code and make sure what ever is highlighted in red color needs to be changed per your settings.
That's it. Pipeline as a code - Jenkinsfile is setup in GitHub.
pipeline {
agent any
tools {
maven 'Maven3'
}
stages {
stage ('Build') {
steps {
sh 'mvn clean install -f MyWebApp/pom.xml'
}
}
stage ('Code Quality') {
steps {
withSonarQubeEnv('SonarQube') {
sh 'mvn -f MyWebApp/pom.xml sonar:sonar'
}
}
}
stage ('JaCoCo') {
steps {
jacoco()
}
}
stage ('Nexus Upload') {
steps {
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'http',
nexusUrl: 'nexus_url:8081',
groupId: 'myGroupId',
version: '1.0-SNAPSHOT',
repository: 'maven-snapshots',
credentialsId: 'fc0f1694-3036-41fe-b3e3-4c5d96fcfd26',
artifacts: [
[artifactId: 'MyWebApp',
classifier: '',
file: 'MyWebApp/target/MyWebApp.war',
type: 'war']
])
}
}
stage ('DEV Deploy') {
steps {
echo "deploying to DEV Env "
deploy adapters: [tomcat9(credentialsId: '268c42f6-f2f5-488f-b2aa-f2374d229b2e', path: '', url: 'http://your_public_dns:8080')], contextPath: null, war: '**/*.war'
}
}
stage ('Slack Notification') {
steps {
echo "deployed to DEV Env successfully"
slackSend(channel:'your slack channel_name', message: "Job is successful, here is the info - Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
stage ('DEV Approve') {
steps {
echo "Taking approval from DEV Manager for QA Deployment"
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you want to deploy?', submitter: 'admin'
}
}
}
stage ('QA Deploy') {
steps {
echo "deploying to QA Env "
deploy adapters: [tomcat9(credentialsId: '268c42f6-f2f5-488f-b2aa-f2374d229b2e', path: '', url: 'http://your_dns_name:8080')], contextPath: null, war: '**/*.war'
}
}
stage ('QA Approve') {
steps {
echo "Taking approval from QA manager"
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you want to proceed to PROD?', submitter: 'admin,manager_userid'
}
}
}
stage ('Slack Notification for QA Deploy') {
steps {
echo "deployed to QA Env successfully"
slackSend(channel:'your slack channel_name', message: "Job is successful, here is the info - Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
}
}
}
Step 5
That's it. Pipeline as a code - Jenkinsfile is setup in GitHub.
Click on commit to save into GitHub.
Create Pipeline and Run pipeline from Jenkinsfile
1. Login to Jenkins
2. Click on New item, give some name and choose Pipeline and say OK
3. Under build triggers, choose Poll SCM,
Enter H/02 * * * *
4. Under Pipeline section. click on choose pipeline script from SCM
5. Under SCM, choose Git
6. Enter HTTPS URL of repo and choose credentials - enter user name/password of GitHub.
Script path as Jenkinsfile
7. Click on Apply and Save
8. Click on Build now.
You should see pipeline running and application is deployed to Tomcat.
https://www.youtube.com/watch?v=nfmt4HWhp5k&list=PLJwvtUqYDmA77rUJ3a_SQgeNpzQka-NGU&index=2
Thursday, December 27, 2018
Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, deploy WARs using Jenkins Pipeline - Build pipelines integrate with Bitbucket, Sonarqube, Slack, JaCoCo, Nexus, Tomcat
Pre-requistes:
1. Install Deploy to container, Slack, Jacoco, Nexus Artifact Uploader and SonarQube plug-ins (if already installed, you can skip it)
Steps to Create Scripted Pipeline in Jenkins
1. Login to Jenkins
2. Create a New item
3. Give name as MyfirstPipelineJob and choose pipeline
4. Click ok. Pipeline is created now
5. Under build triggers, click on poll SCM, schedule as
H/02 * * * *
6. Go to Pipeline definition section, click on Pipeline syntax link. under sample step drop down, choose checkout: Checkout from version control. enter bitbucket or GitHub Repository URL, and enter right credentials. Click here to learn to use PSA if you are using GitHub. scroll down, click on Generate Pipeline script. Copy the code.
7. Now copy the below pipeline code highlighted section into Pipeline section in the pipeline. Please copy stage by stage
8. Change Maven3, SonarQube variables and also Slack channel name as highlighted above in red as per your settings.
9. For Nexus Upload stage, You need to change the Nexus URL and credentials ID for Nexus (which you can grab from Credentials tab after login)
10. For Dev Deploy stage, you can copy credentials ID used for connecting to Tomcat.
node {
def mvnHome = tool 'Maven3'
stage ("checkout") {
copy code here which you generated from step #6
}
stage ('build') {
sh "${mvnHome}/bin/mvn clean install -f MyWebApp/pom.xml"
}
stage ('Code Quality scan') {
withSonarQubeEnv('SonarQube') {
sh "${mvnHome}/bin/mvn -f MyWebApp/pom.xml sonar:sonar"
}
}
stage ('Code coverage') {
jacoco()
}
stage ('Nexus upload') {
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'http',
nexusUrl: 'nexus_url:8081',
groupId: 'myGroupId',
version: '1.0-SNAPSHOT',
repository: 'maven-snapshots',
credentialsId: '2c293828-9509-49b4-a6e7-77f3ceae7b39',
artifacts: [
[artifactId: 'MyWebApp',
classifier: '',
file: 'MyWebApp/target/MyWebApp.war',
type: 'war']
]
)
}
stage ('DEV Deploy') {
echo "deploying to DEV Env "
deploy adapters: [tomcat9(credentialsId: '4c55fae1-a02d-4b82-ba34-d262176eeb46', path: '', url: 'http://your_tomcat_url:8080')], contextPath: null, war: '**/*.war'
}
stage ('Slack notification') {
slackSend(channel:'channel-name', message: "Job is successful, here is the info - Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
stage ('DEV Approve') {
echo "Taking approval from Manager for QA Deploy"
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you approve to deploy into QA environment?', submitter: 'admin'
}
}
stage ('QA Deploy') {
echo "deploying into QA Env "
deploy adapters: [tomcat9(credentialsId: '4c55fae1-a02d-4b82-ba34-d262176eeb46', path: '', url: 'http://your_tomcat_url:8080')], contextPath: null, war: '**/*.war'
}
stage ('QA Approve') {
echo "Taking approval from QA manager"
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you want to proceed to PROD Deploy?', submitter: 'admin,manager_userid'
}
echo "deploying into PROD Env "
deploy adapters: [tomcat9(credentialsId: '4c55fae1-a02d-4b82-ba34-d262176eeb46', path: '', url: 'http://your_tomcat_url:8080')], contextPath: null, war: '**/*.war'
}
}
11. Click Apply, Save
You can watch the Scripted pipeline video in my YouTube channel:
Sunday, May 3, 2020
Create Jenkins Pipeline for automating Docker image creation and push docker image into Docker Hub | Dockerize Python App
- Automating builds
- Automating Docker image creation
- Automating Docker image upload
- Automating Docker container provisioning
Pre-requistes:
1. Jenkins is up and running
2. Docker installed on Jenkins instance and configured.
3. Docker plug-in installed in Jenkins
4. user account setup in https://cloud.docker.com
5. port 8096 is opened up in 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
Now Create an entry for Docker Hub credentials
Make sure you take note of the ID as circled below:
Step # 2 - Create a pipeline in Jenkins, name can be anything
Step # 3 - Copy the pipeline code from below
Make sure you change red highlighted values below:
Your docker user id should be updated.
your registry credentials ID from Jenkins from step # 1 should be copied
pipeline {
agent any
environment {
//once you sign up for Docker hub, use that user_id here
registry = "your_docker_user_id/mypythonapp"
//- update your credentials ID after creating credentials for connecting to Docker Hub
registryCredential = 'fa32f95a-2d3e-4c7b-8f34-11bcc0191d70'
dockerImage = ''
}
stages {
stage('Cloning Git') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url: 'https://bitbucket.org/ananthkannan/mypythonrepo']]])
}
}
// Building Docker images
stage('Building image') {
steps{
script {
dockerImage = docker.build registry
}
}
}
// Uploading Docker images into Docker Hub
stage('Upload Image') {
steps{
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
// Stopping Docker containers for cleaner Docker run
stage('docker stop container') {
steps {
sh 'docker ps -f name=mypythonappContainer -q | xargs --no-run-if-empty docker container stop'
sh 'docker container ls -a -fname=mypythonappContainer -q | xargs -r docker container rm'
}
}
// Running Docker container, make sure port 8096 is opened in
stage('Docker Run') {
steps{
script {
dockerImage.run("-p 8096:5000 --rm --name mypythonappContainer")
}
}
}
}
}
Tuesday, June 9, 2020
Deploy Python App into Kubernetes Cluster using Jenkins Pipeline | Containerize Python App and Deploy into AKS Cluster
- Automating builds using Jenkins
- Automating Docker image creation
- Automating Docker image upload into Docker registry
- Automating Deployments to Kubernetes Cluster
1. AKS Cluster is setup and running. Click here to learn how to create AKS cluster.
4. Docker, Docker pipeline and Kubernetes Deploy plug-ins are installed in Jenkins
Click on Global credentials
Now Create an entry for your Docker Hub account. Make sure you enter the ID as dockerhub
Make sure you change red highlighted values below:
Your docker user id should be updated.
your registry credentials ID from Jenkins from step # 1 should be copied
label 'myslave'
}
environment {
//once you sign up for Docker hub, use that user_id here
registry = "your_docker_hub_user_id/mypython-app"
//- update your credentials ID after creating credentials for connecting to Docker Hub
registryCredential = 'dockerhub'
dockerImage = ''
}
stages {
stage ('checkout') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/akannan1087/myPythonDockerRepo']]])
}
}
stage ('Build docker image') {
steps {
script {
dockerImage = docker.build registry
}
}
}
// Uploading Docker images into Docker Hub
stage('Upload Image') {
steps{
script {
docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}
}
}
}
stage ('K8S Deploy') {
steps {
script {
kubernetesDeploy(
configs: 'k8s-deployment.yaml',
kubeconfigId: 'K8S',
enableConfigSubstitution: true
)
}
}
}
}
}
Thursday, October 1, 2020
How to create AKS cluster using Azure CLI | Create Kubernetes Cluster using Azure CLI
What is Azure Kubernetes Service (AKS)
AKS is a managed Kubernetes service that lets you quickly deploy and manage clusters. We will see how to create AKS cluster in Azure cloud using Azure CLI.
Pre-requistes:
- Azure CLI is installed on your local machine.
- Account setup in Azure.
Create Resource Group
Make sure you are login to Azure portal first.
az login
You need to create a resource group first.Create AKS cluster with 2 worker nodes
az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 2 --enable-addons monitoring --generate-ssh-keys
az aks show --name myAKSCluster --resource-group myResourceGroup
The above command should display Cluster exists in Azure portal
Create Azure Container Registry
Run the below command to create your own private container registry using Azure Container Registry (ACR).
az acr create --resource-group myResourceGroup --name myacrrepo --sku Standard --location southcentralus
Connect to the cluster
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster --overwrite-existing
To verify the connection to your cluster, use the kubectl get command to return a list of the cluster nodes.
kubectl get nodes
# List all deployments in a specific namespace
kubectl get deployments --all-namespaces=true
Let's deploy some apps into AKS cluster.
Deploy Nginx Appkubectl create -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/controllers/nginx-deployment.yaml
Once the deployment is created, use kubectl to check on the deployments by running this command:
kubectl get deployments
Delete the cluster
To avoid Azure charges, you should clean up unneeded resources. When the cluster is no longer needed, use the az group delete command to remove the resource group, container service, and all related resources.
az group delete --name myResourceGroup --yes --no-wait
Please watch the above steps in action in YouTube
Tuesday, December 8, 2020
How to setup Jenkins slave node to run Docker Builds | Setup Jenkins Slave and Install Docker
How to configure Jenkins Slave to run Docker builds?
sudo usermod -aG docker jenkins
sudo systemctl daemon-reload
sudo systemctl restart docker
Execute the below command in Jenkins master Ec2.
sudo cat ~/.ssh/id_rsa.pub
Copy the output of the above command:
Now go to Slave node and execute the below command
sudo -u jenkins vi /home/jenkins/.ssh/authorized_keys
Once you pasted the public keys in the above file in Slave, come out of the file by entering wq!
Login to master node and try to SSH from Master to Slave
ssh jenkins@slave_node_ip
this is to make sure master is able to connect slave node. once you are successfully logged into slave, type exit to come out of slave.
Now copy SSH keys into /var/lib/jenkins/.ssh folder also by executing below command in Jenkins master(make sure you exited from slave by typing exit command:
Now to go Jenkins Master, manage jenkins, manage nodes.
Click on new node. give name and check permanent agent.
give name and no of executors as 1. enter /home/jenkins as remote directory.
select launch method as Launch slaves nodes via SSH.
enter Slave node ip address as Host.
click on credentials. Enter user name as jenkins. Make jenkins lowercase as it is shown.
Kind as SSH username with private key. enter private key of master node directly by executing below command:
sudo cat ~/.ssh/id_rsa
(Make sure you copy the whole key including the below without missing anything)
-----BEGIN RSA PRIVATE KEY-----
-----
-----END RSA PRIVATE KEY-----
click Save.
select Host key verification strategy as "manually trusted key verification strategy".
Click Save.
Click on launch agent..make sure it connects to agent node.
ubuntu@ip-172-31-58-13:~$ sudo service jenkins restart
ubuntu@ip-172-31-58-13:~$ sudo cat ~/.ssh/id_rsa.pub
cat: /home/ubuntu/.ssh/id_rsa.pub: No such file or directory
ubuntu@ip-172-31-58-13:~$
I googled and found that you missed to specify one command. Let me know if this is the case..
ubuntu@ip-172-31-58-13:~$ ssh-keygen -t rsa -C "MyEmailAddress" -f ~/.ssh/id_rsa -P ""
Generating public/private rsa key pair.
Your identification has been saved in /home/ubuntu/.ssh/id_rsa.
Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:pUlkEw5AXcRCKunGNI5n+BSOvy+S7bX99E6T651K2Q4 MyEmailAddress
The key's randomart image is:
+---[RSA 2048]----+
| .o+o+B. |
| . .o=.. |
| * . .o . |
| X + . + |
|+ X S |
| B + |
| oo . . E . |
|o oo o . + * . |
| oooo ...o*.+ |
+----[SHA256]-----+
ubuntu@ip-172-31-58-13:~$ sudo cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRiJyy7P7kHsHxgwW+5t9+BFMYxt995WVseE1nphQCV6BUXxXE74Y1OEuA2VP3dYGZJ33TKSS8OYH6D+AmSufwgmUZ4CkdbsUSKDeeo2SSbDu/z+eeeghmd5Ccmxx4oyx/A01Bwl4fbOumQoeTASxUbYdO0B3C1aXCF6+2sZJAJQ/2O5tOuwi3gbbAe/kJ+GkfjiHkhSC0UXg1wtjZ72XflNNGYo2bHYlFu8wpMRiYRhGGlVIXWjZEQFSR9TGF5V76d1ceJqoA/rRJfija8Wr8I2HX5VPMP62bkLWtP1y51fI+9atSH1+gUMAZERQ+U161P7eA+UEa/5j5AHt7PSjp MyEmailAddress
ubuntu@ip-172-31-58-13:~$
Jenkins Pipeline for Microservices Deployment to EKS Cluster | Jenkins Kubernetes Deployment to EKS
Tuesday, December 15, 2020
Deploy Springboot Microservices App into Amazon EKS Cluster using Jenkins Pipeline | Containerize Springboot App and Deploy into EKS Cluster using Jenkins Pipeline
We will learn how to automate Docker builds using Jenkins pipelines and Deploy into AWS EKS - Kubernetes Cluster with help of Kubernetes Continuous Deploy plug-in.
We will use Springboot Microservices based Java application. I have already created a repo with source code + Dockerfile. The repo also have Jenkinsfile for automating the following:
- Automating builds using Jenkins
- Automating Docker image creation
- Automating Docker image upload into Docker Hub
- Automating Deployments to Kubernetes Cluster
1. Amazon EKS Cluster is setup and running. Click here to learn how to create Amazon EKS cluster.
4. Docker, Docker pipeline and Kubernetes Continuous Deploy plug-ins are installed in Jenkins
Step #1 -Make sure Jenkins can run Docker builds after validating per pre-requistes
Click on Global credentials
Now Create an entry for your Docker Hub account. Make sure you enter the ID as dockerhub
Step # 4 - Create Maven3 variable under Global tool configuration in Jenkins
By default, clusterrolebinding has system:anonymous set which blocks the cluster access. Execute the following command to set a clusterrole as cluster-admin which will give you the required access.
Make sure you change red highlighted values below as per your settings:
Your docker user id should be updated.
your registry credentials ID from Jenkins from step # 1 should be copied
node ("slave") {
def image
def mvnHome = tool 'Maven3'
stage ('checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url: 'https://bitbucket.org/ananthkannan/myawesomeangularapprepo/']]])
}
stage ('Build') {
sh 'mvn -f MyAwesomeApp/pom.xml clean install'
}
stage ('Docker Build') {
// Build and push image with Jenkins' docker-plugin
withDockerRegistry([credentialsId: "dockerhub", url: "https://index.docker.io/v1/"]) {
image = docker.build("akdevopscoaching/mywebapp", "MyAwesomeApp")
image.push()
}
}
stage ('K8S Deploy') {
kubernetesDeploy(
configs: 'MyAwesomeApp/springboot-lb.yaml',
kubeconfigId: 'K8S',
enableConfigSubstitution: true
)
}
}
Friday, April 10, 2020
Install Jenkins on Ubuntu 18.0.4 | Setup Jenkins on AWS EC2 Ubuntu instance | How to setup Jenkins in Ubuntu EC2 instance?
Perform update first
sudo apt update
Install Java 11
Verify Java Version
Maven is a popular build tool used for building Java applications. Please click here to learn more about Maven. You can install Maven by executing below command:
sudo apt install maven -y
Add Repository key to the system
Append debian package repo address to the system
Access Jenkins in web browser
Now Go to AWS console. Click on EC2, click on running instances link. Select the checkbox of EC2 you are installing Java and Jenkins. Click on Action. Copy the value from step 4 that says --> Connect to your instance using its Public DNS:
Now go to browser. enter public dns name or public IP address with port no 8080.
You may get screen, enter the below command in Git bash( Ubuntu console)
Wednesday, September 1, 2021
How to install Terraform on Red Hat Linux | TerraForm Installation on Red Hat Linux
Terraform is an infrastructure as a code tool used for provisioning infrastructure on most of the cloud platforms.
- Open source
- Can setup entire infrastructure by writing Terraform scripts/templates.
- Based on declarative model
- Uses Hashi Corp Language(HCL) which is JSON format
You can watch this on YouTube channel:
Please find steps for installing Terraform On Enterprise Red Hat Linux.
Install wget utility
sudo yum install wget -y
Download Terraform from Hasicorp website
sudo yum install unzip -y
Unzip Terraform Zip file
sudo unzip terraform_1.0.5_linux_amd64.zip
Add terraform to PATH
sudo mv /opt/terraform/terraform /usr/bin/
terraform -version
Monday, October 12, 2020
Create Amazon EKS cluster by eksctl | How to create Amazon EKS cluster using EKSCTL | Create EKS Cluster in command line
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 Azure, 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-requistes:
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.
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
.
Create EKS Cluster using eksctl
eksctl create cluster --name demo-eks --region us-east-2 --nodegroup-name my-nodes --node-type t3.small --managed
the above command should create a EKS cluster in AWS, it might take 5 to 10 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.
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:
kubectl create deployment nginx --image=nginx
View Deployments
kubectl get deployments
Delete EKS Cluster using eksctl
eksctl delete cluster --name demo-eks --region us-east-2
the above command should delete the EKS cluster in AWS, it might take a few mins to clean up the cluster.
Errors during Cluster creationeksctl delete cluster --name demo-eks --region us-east-2
Saturday, May 18, 2019
How to setup SSH keys | How to setup Repo and Create Java Project in GitHub - How to add a project in GitHub
Step # 2 Create SSH keys from your source machine
sudo cat ~/.ssh/id_rsa.pub
Step # 3 - Upload SSH Keys in GitHub
Step # 4 - Clone Repo locally
Now click on the Cat icon on your top left to go back to repo you just created.Click on the repo you created in step # 1, click on Code, under SSH
Copy the SSH url and go to your EC2 instance using git bash and perform below command:
git clone <paste the ssh url >
type yes to connect
type below command to list the directory
ls -al
The above command should list the directory you have cloned.
Now go into repo folder(red circled like above) you have cloned.
Step # 5 - Create Java Web App using Maven
Step # 6 - Push Java Web App using Git commands into GitHub
type below command to see the new folder called MyWebApp
ls -al
type below command to see the newly created project in red color
git push
Saturday, February 16, 2019
Create Freestyle job in Jenkins | How to create build job in Jenkins to automate build and deployment
See below the steps for configuring Jenkins to automate the build and deployment for the project we already set up in Bitbucket or Git Hub.
JaCoCo
enter name as myFirstAutomateJob. click OK.
Click on your repo, Copy the url from the browser. Paste the url as Repository URL below.
Tuesday, October 13, 2020
Install kubectl on Ubuntu Instance | How to install kubectl in Ubuntu
Kubernetes uses a command line utility called kubectl
for communicating with the cluster API server.
How to install Kubectl in Ubuntu instance
Tuesday, February 12, 2019
Jenkins setup - Install Java, Jenkins, Maven, Tomcat on Ubuntu EC2 - How to install Java, Jenkins, Maven, Tomcat on Ubuntu EC2
Java Setup on Ubuntu
sudo apt-get update
Install Java 11
sudo apt-get install default-jdk -y
Add Repository key to the system
Append debian package repo address to the system
The above screenshot should confirm that Jenkins is successfully installed.
Access Jenkins in web browser
Now Go to AWS console.
Click on EC2, click on running instances link. Select the checkbox of EC2 you are installing Java and Jenkins.
Click on Action.Copy the value from step 4 that says --> Connect to your instance using its Public DNS:
Unlock Jenkins
You may get screen, enter the below command in Git bash( Ubuntu console)
Maven is a build tool used for building Java applications. Please click here to learn more about Maven. You can install Maven by executing below command:
sudo apt install maven -y
Tomcat is a web server or web container where java web application can be deployed by developers. You can learn more about by clicking this URL. Tomcat can be installed by executing below commands:
sudo apt-get update
sudo apt-get install tomcat8 -y
Change port no from 8080 to 8090
Tomcat default port is also 8080, since we have already used 8080 for Jenkins, we need to change from 8080 to 8090. You can change by modifying server.xml
sudo vi /var/lib/tomcat8/conf/tomcat-
Scroll down all the way to the end of the file,
Add the below lines in second last line above (above </tomcat-users>)
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-gui,manager-script"/>
Look for the line starting JAVA_OPTS and comment that line by adding #.
JAVA_OPTS="-Djava.security.
It works!!!!
That's it. You have setup both Jenkins and Tomcat successfully!!
Please watch here for live demo:
Easy to understand and follow. As said, the migration to cloud is very essential for the protection of the database.
Cloud Migration services
Aws Cloud Migration services
Azure Cloud Migration services
Vmware Cloud Migration services
Database Migration services
Cloud Migration Tool
Best Cloud Migration Tool
Lia Infraservices