Real application industry-based project on DevOps๐ป
๐ฐ๐๐ซ๐จ๐ฃ๐๐๐ญ ๐๐ข๐ญ๐ฅ๐ :
๐๐๐ ๐๐ฎ๐๐๐ซ๐ง๐๐ญ๐๐ฌ ๐ญ๐จ ๐๐๐ฉ๐ฅ๐จ๐ฒ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐/๐๐ ๐ญ๐จ๐จ๐ฅ ๐ฎ๐ฌ๐ข๐ง๐ ๐๐ฎ๐ญ๐จ๐ฆ๐๐ญ๐๐ ๐ฐ๐๐ฒ ๐๐ฉ๐๐ซ๐๐ญ๐จ๐ซ, ๐๐ง๐ ๐ฆ๐๐ง๐๐ ๐ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ข๐ฉ๐๐ฅ๐ข๐ง๐ ๐๐ฌ ๐๐จ๐๐ ๐๐ฒ ๐๐๐ง๐ค๐ข๐ง๐ฌ ๐๐ฎ๐๐๐ซ๐ง๐๐ญ๐๐ฌ ๐๐๐ ๐๐ง๐ ๐๐ฉ๐ฉ๐ฅ๐ข๐๐๐ญ๐ข๐จ๐ง ๐ฃ๐จ๐๐ฌ ๐ฅ๐๐ฎ๐ง๐๐ก๐๐ฌ ๐ข๐ง ๐๐ฒ๐ง๐๐ฆ๐ข๐ ๐ฉ๐ซ๐จ๐ฏ๐ข๐ฌ๐ข๐จ๐ง๐ข๐ง๐ ๐ง๐จ๐๐ ๐จ๐ฎ๐ซ ๐ค๐ฎ๐๐๐ซ๐ง๐๐ญ๐๐ฌ ๐๐๐ฉ๐ฅ๐จ๐ฒ๐ฆ๐๐ง๐ญ ๐ฉ๐จ๐๐ฌ ๐๐ง๐ ๐ฆ๐จ๐ง๐ข๐ญ๐จ๐ซ๐ข๐ง๐ ๐จ๐ ๐ข๐ง๐๐ซ๐๐ฌ๐ญ๐ซ๐ฎ๐๐ญ๐ฎ๐ซ๐ ๐ฅ๐จ๐ ๐๐ฒ ๐๐ซ๐๐๐๐ง๐ ๐๐จ๐ค๐ข ๐๐ง๐ ๐๐ซ๐จ๐ฆ๐ญ๐๐ข๐ฅ ๐๐ง๐ ๐๐๐ญ๐ซ๐ข๐๐ฌ ๐๐ฒ ๐๐ซ๐จ๐ฆ๐๐ญ๐ก๐๐ฎ๐ฌ ๐๐จ๐ง๐ข๐ญ๐จ๐ซ๐ข๐ง๐ ๐๐จ๐จ๐ฅ๐ง๐ ๐๐จ๐จ๐ฅ
Letโs start๐๏ธโโ๏ธ
Cloud Setup
- AWS cloud https://aws.amazon.com/
- New User / Account: IAM user -> power : policy: admin access
- password (key) access / secret key
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ -
CLI setup
- Aws CLI download for Windows:
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
2. login in CLI # aws configure
3. eksctl tool: To install Kubernetes
https://github.com/eksctl-io/eksctl/releases/tag/v0.161.0
4: store files in this Folder
cd C:\Program Files\Kubernetes
๐ PRACTICAL โ Launch EKS Cluster
3 ways by which we can use AWS EKS service
- WebUI
3rd Party tool๐กช Terraform
3rd Party tool๐กช eksctl tool, specifically for EKS service of AWS This tool was developed by Weaveworks.
- Now create a user by using IAM.
An access key and secret key will be created. Now use this access key and secret key to configure AWS.
After configuring AWS, we will install eksctl
Now go to releases๐กช latest๐กชeksctl_windows_amd64.zip
After downloading create a folder say awsekstools and extract downloaded data into that folder.
Now extract that into the folder
Now go to environmental variables
Now check
Installation Succcesfull๐
๐ Helm Installation
Visit the official Helm Release page on GitHub.
https://github.com/helm/helm/releases
2. Locate the Windows amd64 download link from the Installation platform list and select it to download.
3. Extract the zip file. You will have these files inside the extracted folder.
4. Create a folder called kubernetes on the Desktop and copy the extracted helm.exe to that folder.
5. Now right-click on this file, More Options>Properties. Then copy the Location of this file.
6. Now search for environment in the search box and open the first result.
7. Now click on Environment Variables Again
8. Select the Path variable and click on EDIT.
9. Now click on NEW and paste the Location of helm.exe
10. Click OK>OK>Apply.
11. Now open the command prompt and you can run
$ helm
Installation of the helm is successfully done.๐คฉ
๐ Kubectl Installation
- Download the kubectl executable from below link
https://dl.k8s.io/release/v1.28.2/bin/windows/amd64/kubectl.exe
- Create a folder on your desktop called Kubernetes and move the download file to this folder.
Now right-click on this file, More Options>Properties. Then copy the Location of this file.
Now search for the environment in the search box
Open the first result
Now click on Environment Variables Again
- Select the Path variable and click on EDIT.
- Now click on NEW and paste the Location of kubectl.exe
Click OK>OK>Apply.
Now open the command prompt and you can run
$ kubectl version
The installation of Kubectl is successful.๐คฉ
Now letโs do practical
For reference visit the GitHub
devops_workshop_eks_jenkins_loki_operator
Install Kubernetes over AWS cloud
eksctl create cluster - name mycluster1 - region=us-east-1
This command creates an Amazon Elastic Kubernetes Service (Amazon EKS) cluster named โmycluster1โ in the โus-east-1โ AWS region.
kubectl create namespace lwns
This command creates a new Kubernetes namespace named โlwns.โ
helm repo add jenkins https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart
This command adds a Helm repository named โJenkinsโ to your Helm configuration. The repository is located at the specified URL, which contains Helm charts for deploying Jenkins using the Kubernetes Operator.
If this command does not work on your computer due to network restrictions or firewall issues, you may need to use a VPN to access the repository. Follow the steps below to use a VPN:
Download VPN from Here:
https://drive.google.com/file/d/1wyyPF_r9jRGwn5vK-184blDhwz1deRJu/view?usp=sharing
- Search Australia and start a VPN.
- Once connected to the VPN, retry the `helm repo add` command.
helm install my-jenkins-operator jenkins/jenkins-operator -n lwns - set jenkins.enabled=false
This command uses Helm to install a Kubernetes application named โmy-jenkins-operatorโ from the โjenkins/jenkins-operatorโ Helm chart. The application is deployed in the โlwnsโ namespace.
Curl https://raw.githubusercontent.com/dilip8700/devops_workshop_eks_jenkins_loki_operator/main/jenkins_instance.yml >> jenkins_instance.yml
Use this command to create a Kubernetes YAML file.
kubectl apply -f jenkins_instance.yml
kubectl - namespace lwns get secret jenkins-operator-credentials-example -o 'jsonpath={.data.user}' | base64 -d
This is used to retrieve sensitive information such as usernames stored as secrets in a Kubernetes cluster.
kubectl - namespace lwns get secret jenkins-operator-credentials-example -o 'jsonpath={.data.password}' | base64 -d
This is used to retrieve sensitive information such as passwords stored as secrets in a Kubernetes cluster.
kubectl - namespace lwns port-forward jenkins-example 8080:8080
This command sets up a port-forwarding connection in the โlwnsโ namespace, forwarding local port 8080 to port 8080 on the Kubernetes pod named โJenkins-example.โ This enables you to access the Jenkins web interface running inside the โJenkins-exampleโ pod through your local machineโs web browser by opening http://localhost:8080.
helm repo add grafana https://grafana.github.io/helm-charts
- This will add a repo in the helm chat for Grafana.
helm repo update
It will update the helm repo
helm.exe upgrade - install loki grafana/loki-stack - set grafana.enabled=true,prometheus.enabled=true,prometheus.alertmanager.persistentVolume.enabled=false,prometheus.server.persistentVolume.enabled=false
Use this command to install Loki, Grafana, and Prometheus.
kubectl patch svc loki-grafana -p '{"spec": {"type": "LoadBalancer"}}'
This command modifies a Kubernetes service named โloki-grafanaโ by changing its type to โLoadBalancer.โ The LoadBalancer type allows external access to the service, typically by assigning it a public IP address for internet accessibility.
kubectl get svc loki-grafana -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
This command gives you the hostname of the load balancer which you can use to connect.
AWS Loadbalancer takes 2 min to set up so wait for 2 minutes.
kubectl get secret loki-grafana -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
This command will give you a Grafana username and password.
๐ฅ Project Done ๐
๐ฐ Check out my Video on LinkedIn for the interesting performance on this project๐ฅ
Visit on Linkedihttps://www.linkedin.com/posts/sa-chin_devops-project-kubernetes-activity-7117743125770502144--A5A?utm_source=share&utm_medium=member_androidn
I really hope you liked my article and found it helpful. โบ๏ธ
If this project was helpful, please do follow and click the clap ๐ button below to show your support ๐
_Thank you for reading๐
Follow for more content๐ค
keep learning keep sharing
stay tuned๐