Saturday, January 22, 2022

Install Helm 3 Linux - Setup Helm 3 on Linux | Install Helm 3 on Ubuntu | Setup Helm 3 on Linux | Setup Helm 3 on Ubuntu

What is Helm and How to install Helm version 3?

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.

Why use Helm?

As the Kubernetes platform and ecosystem continued to expand, deploying one and only one Kubernetes configuration file (ie: a single YAML) was not the norm anymore. As number of K8S deployment files increased, how to manage those files? Helm solves that problem. 

Helm Charts

Helm uses a packaging format called Charts. A Helm Chart is a collection of files that describe a set of Kubernetes resources. Helm Charts helps you define, install, and upgrade even the most complex Kubernetes application. Charts are easy to create, version, share, and publish.


Helm Kubernetes Integration

In helm 3 there is no tiller component. Helm client directly interacts with the Kubernetes API for the helm chart deployment.

Helm 3 can be installed many ways. We will install Helm 3 using scripts option.

Download scripts 
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3

provide permission
sudo chmod 700 get_helm.sh

Execute script to install
sudo ./get_helm.sh

 
Verify installation
helm version --client



Watch the steps in YouTube channel:


Tuesday, January 11, 2022

Install SonaType Nexus 3 using Docker Compose | Install SonaType Nexus 3 using Docker on Ubuntu 22.0.4 | Install Nexus 3 using Docker-Compose

How to setup SonaType Nexus 3 using Docker compose?

Nexus is open source, binary repository manager and Java based tool. It can be installed quickly using Docker with less manual steps.

What is Docker Compose?
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. Since Docker Compose lets you configure related containers in a single YAML file, you get the same Infrastructure-as-Code abilities as Kubernetes. But they come in a simpler system that’s more suited to smaller applications that don’t need Kubernetes’ resiliency and scaling.
 
The purpose of docker-compose is to function as docker cli but to issue multiple commands much more quickly. To make use of docker-compose, you need to encode the commands you were running before into a docker-compose.yml file
 
Run docker-compose up to run the entire app.

Watch Steps in YouTube channel:

Pre-requisites:

  • Ubuntu EC2 up and running with at least t2.medium(4GB RAM), 2GB will not work
  • Port 8081, 8085 is opened in security firewall rule
  • instance should have docker and docker-compose installed

Change Host Name to Nexus
sudo hostnamectl set-hostname Nexus

Perform System update
sudo apt update

Install Docker-Compose
sudo apt install docker-compose -y

Add current user to Docker group
sudo usermod -aG docker $USER

Create docker-compose.yml
this yml has all the configuration for installing Nexus on Ubuntu EC2.
sudo vi docker-compose.yml 

(Copy the below code high-lighted in yellow color)
version: "3"
services:
  nexus:
    image: sonatype/nexus3
    restart: always
    volumes:
      - "nexus-data:/sonatype-work"
    ports:
      - "8081:8081"
      - "8085:8085"
volumes:
  nexus-data: {}

Save the file by entering :wq!

Now execute the compose file using Docker compose command to start Nexus Container
sudo docker-compose up -d 


-d means detached mode

Make sure Nexus 3 is up and running
sudo docker-compose logs --follow


Once you see the message, that's it. Nexus 3 is been setup successfully. Now press Control C and enter to come out of the above screen.

How to get Nexus admin password?
Now access Nexus UI by going to browser and enter public dns name with port 8081
Now to go to browser --> http://change to_nexus_publicdns_name:8081

We need to login to Nexus docker container to get Nexus admin password.

Identify Docker container name
sudo docker ps


Get admin password by executing below command
sudo docker exec -it ubuntu_nexus_1 cat /nexus-data/admin.password


Please follow below steps for integrating Nexus 3 with Jenkins

Deploy Springboot Microservices App into Amazon EKS Cluster using Jenkins Pipeline and Kubectl CLI Plug-in | Containerize Springboot App and Deploy into EKS Cluster using Jenkins Pipeline

We will learn how to automate springboot microservices builds using Jenkins pipeline and Deploy into AWS EKS Cluster with help of Kubernetes CLI 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 AWS ECR
- Automating Docker Containers Deployments to Kubernetes Cluster
 


 
Watch steps in YouTube channel:

Same Code for this video is here:

Pre-requisites:
1. Amazon EKS Cluster is setup and running. Click here to learn how to create Amazon EKS cluster.
5. Docker, Docker pipeline and Kubernetes CLI plug-ins are installed in Jenkins




6. Install kubectl on your instance

Step # 1 - Create Maven3 variable under Global tool configuration in Jenkins
Make sure you create Maven3 variable under Global tool configuration. 


Step #2 - Create Credentials for connecting to Kubernetes Cluster using kubeconfig
Click on Add Credentials, use Kubernetes configuration from drop down.

use secret file from drop down.


execute the below command to login as jenkins user.
sudo su - jenkins

you should see the nodes running in EKS cluster.

kubectl get nodes


Execute the below command to get kubeconfig info, copy the entire content of the file:
cat /var/lib/jenkins/.kube/config


Open your text editor or notepad, copy and paste the entire content and save in a file.
We will upload this file.

Enter ID as K8S and choose File and upload the file and save.


Enter ID as K8S and choose enter directly and paste the above file content and save.

Step # 3 - Create a pipeline in Jenkins
Create a new pipeline job.


Step # 4 - Copy the pipeline code from below
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

pipeline {
   tools {
        maven 'Maven3'
    }
    agent any
    environment {
        registry = "account_id.dkr.ecr.us-east-1.amazonaws.com/my-docker-repo"
    }
   
    stages {
        stage('Cloning Git') {
            steps {
                checkout([$class: 'GitSCM', branches: [[name: '*/main']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url: 'https://github.com/akannan1087/springboot-app']]])     
            }
        }
      stage ('Build') {
          steps {
            sh 'mvn clean install'           
            }
      }
    // Building Docker images
    stage('Building image') {
      steps{
        script {
          dockerImage = docker.build registry 
        }
      }
    }
   
    // Uploading Docker images into AWS ECR
    stage('Pushing to ECR') {
     steps{  
         script {
                sh 'aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin account_id.dkr.ecr.us-east-1.amazonaws.com'
                sh 'docker push account_id.dkr.ecr.us-east-1.amazonaws.com/my-docker-repo:latest'
         }
        }
      }

       stage('K8S Deploy') {
        steps{   
            script {
                withKubeConfig([credentialsId: 'K8S', serverUrl: '']) {
                sh ('kubectl apply -f  eks-deploy-k8s.yaml')
                }
            }
        }
       }
    }
}

Step # 5 - Build the pipeline
Once you create the pipeline and changes values per your configuration, click on Build now:


Step # 6 - Verify deployments to K8S

kubectl get pods



kubectl get deployments

kubectl get services


If you see any errors after deploying the pods, you can check the pod logs.
kubectl logs <pod_name>

Steps # 7 - Access SpringBoot App in K8S cluster
Once build is successful, go to browser and enter master or worker node public ip address along with port number mentioned above
http://loadbalancer_ip_address

You should see page like below:



Note:

and make changes in eks-deploy-k8s.yaml to pull Docker image from your AWS ECR repo.

Saturday, January 8, 2022

Deploy Springboot Microservices App into Amazon AKS Cluster using Jenkins Pipeline | Containerize Springboot App and Deploy into AKS Cluster using Jenkins Pipeline

We will learn how to automate Docker builds using Jenkins pipelines and Deploy into Azure Kubernetes Cluster(AKS) 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 Azure Container Registry
- Automating Deployments to Kubernetes Cluster


Pre-requisites:
1. AKS Cluster is setup and running. Click here to learn how to create AKS cluster.
2. Jenkins Master is up and running. 
3. Setup Jenkins slave to run Docker builds
4. Docker, Docker pipeline and Kubernetes Deploy plug-ins are installed in Jenkins



5. Docker hub account setup in https://cloud.docker.com


Step #1 - Create Credentials for Docker Hub
Go to Jenkins UI, click on Credentials -->


Click on Global credentials
Click on Add Credentials


Now Create an entry for your Docker Hub account. Make sure you enter the ID as dockerhub

Step #2 - Create Credentials for Kubernetes Cluster
Click on Add Credentials, use Kubernetes configuration from drop down.


execute the below command to get kubeconfig info, copy the entire content of the file:
sudo cat ~/.kube/config


Enter ID as K8S and choose enter directly and paste the above file content and save.

Step # 3 - Create a pipeline in Jenkins
Create a new pipeline job.


Step # 4 - 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 {
        label "slave"
    }

    tools {
        maven 'Maven3'
    }
    environment {
        registry = "akdevopscoaching/springbootapp"
        registryCredential = "dockerhub"
        def image = ''
    }
    
    stages {
        stage('Checkout') {
            steps {
                checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://bitbucket.org/ananthkannan/myawesomeangularapprepo']]])    
            }
        }
        
    stage ('Build') {
        steps {
            sh 'mvn -f MyAwesomeApp/pom.xml clean install'           
        }
    }
        
    stage ('Docker Build') {
        steps {
            script 
            {
         // Build and push image with Jenkins' docker-plugin
            withDockerRegistry([credentialsId: "dockerhub", url: "https://index.docker.io/v1/"]) {
            image = docker.build("akdevopscoaching/springbootapp", "MyAwesomeApp")
            image.push()    
            }
            }
        }
    }
    
      stage ('K8S Deploy') {
       steps {
                kubernetesDeploy(
                    configs: 'MyAwesomeApp/springboot-docker-hub.yaml',
                    kubeconfigId: 'K8S',
                    enableConfigSubstitution: true
                    )               
        }
      }
  }
}


Step # 5 - Build the pipeline
Once you create the pipeline and changes values per your Docker user id and credentials ID, click on 


Step # 6 - Verify deployments to K8S

kubectl get pods


kubectl get deployments

kubectl get services


Steps # 7 - Access SpringBoot App in K8S cluster
Once build is successful, go to browser and enter master or worker node public ip address along with port number mentioned above
http://master_or_worker_node_public_ipaddress:port_no_from_above

You should see page like below:


Please watch the above steps in YouTube channel: 


Top 10 DevOps Popular Tools | Popular DevOps Tools You Must Know In 2023 | Learn DevOps Tools in 2023

Here are the top 10 DevOps Tools to focus on to put your DevOps learning in fast-track and kick start your career quickly as a Cloud or DevOps engineer in about 8 weeks from now.

1.    Terraform # 1 Infrastructure automation tool
2.    Git – BitBucket/GitHub/Azure Git - # 1 - SCM tool
3.    Jenkins, Maven, Master/Slave, Pipelines - scripted, declarative - # 1 CI tool
4.    Docker# 1 Container platform 
5.    Kubernetes # 1 container orchestration tool 
6.    Ansible# 1 Configuration Management tool
7.    Azure DevOps, Pipelines – Microsoft platform for migrating applications to Azure Cloud
8.    SonarQube – # 1 Code quality tool
9.    Slack – # 1 Collaboration tool
10.  Nexus – # 2 Binary repo manager 

Finally having some scripting knowledge is also good – Python, YAML playbooks, JSON script
Cloud experience - AWS and Azure
Watch about each of the above tools in YouTube..

Tuesday, January 4, 2022

Top DevOps Skills for 2024 | Skills required to become a DevOps engineer

We all know how DevOps is trending right now. And we know where it is going. Let's get to know what skills will make you a successful a DevOps engineer.

Top DevOps skills for 2024

1. Any cloud knowledge and experience - AWS, Azure and Google cloud

2. Linux knowledge and scripting - basic troubleshooting, intermediate scripting, looking at the logs

3. Experience in Git, GitHub, Bitbucket or any version control systems such as SVN, TFVC

4. Experience in Continuous integrations tools such as Jenkins, TeamCity, Circle CI 

5. Experience in Infrastructure automation tools such as Terraform, AWS cloud formation

6. Experience in Configuration Management tools such as Ansible, Puppet or Chef

7. Experience in containers such as Docker and Kubernetes

8. Experience in basic to intermediate Scripting. Advanced scripting needed for Sr.Devops folks.

9. Ability to troubleshoot in case builds, deployments failure.

Soft skills

These days employers are not only looking for strong technical skills but also looking "soft skills" which are essentials to become successful in IT. If you think if you are lagging on any of these skills, no worries. All these skills can be developed and improved over period of time by practicing.

1. Open minded

2. Willingness to learn new skills

3. Communication

4. Approachable

5. "Get it done" attitude

6. Being adaptable. 

DevSecOps Bootcamp Dec 2024 Schedule | DevSecOps & AWS Azure Cloud Coaching by Coach AK | DevSecOps and Cloud Computing Online Classes

Lot of new topics covered like GitHub Actions, GitHub Advanced Security, Helm, Prometheus and Grafana..) The DevOps requirements in the IT m...