Vish DevOpsMiniBytes
Vish's Quick BrainTuning to DevOps concepts

Hello reader, this is Vish currently working as a DevOps Engineer for the past 3+ years and a total of 9+ years of experience in the IT industry. Am passionate about learning DevOps and in the mission of enhancing my learning into container orchestration tools, monitoring and security.
Hi all, this blog consists of quick small concepts to revise/braintune the DevOps concepts. This blog can also be used for interview purposes where I would append with new content on regular basis.
1.โฐ๐ฆ๐ฒ๐/๐๐ต๐ฎ๐ป๐ด๐ฒ ๐ง๐ถ๐บ๐ฒ ๐ญ๐ผ๐ป๐ฒ ๐ผ๐ณ ๐ฎ ๐๐ถ๐ป๐๐ ๐ ๐ฎ๐ฐ๐ต๐ถ๐ป๐ฒ โฐ
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: timedatectl
๐ shows the current timezone with additional details related to datetime
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: timedatectl list-timezones
๐ used to list all the available timezones
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: timedatectl set-timezone Asia/Kolkata
๐ used to set the timezone Asia/Kolkata
2.๐ป ๐๐ถ๐บ๐ถ๐ ๐๐ฃ๐จ & ๐ ๐ฒ๐บ๐ผ๐ฟ๐ ๐ผ๐ณ ๐๐ผ๐ฐ๐ธ๐ฒ๐ฟ ๐๐ผ๐ป๐๐ฎ๐ถ๐ป๐ฒ๐ฟ โ๏ธ
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ:
๐ป docker run -dt --name vish_cont --memory 100m --cpus 0.5 busybox
๐๐starts a container named ๐๐ถ๐๐ต_๐ฐ๐ผ๐ป๐ with ๐ญ๐ฌ๐ฌ ๐ ๐ of memory and ๐ฌ.๐ฑ ๐ฐ๐ผ๐ฟ๐ฒ๐ of CPU
๐น๐ฉ๐ฎ๐น๐ถ๐ฑ๐ฎ๐๐ถ๐ผ๐ป ๐ผ๐ณ ๐ ๐ฒ๐บ๐ผ๐ฟ๐:
๐ป docker stats vish_cont
๐๐ shows the stats of the running container
๐ป docker exec -it vish_cont sh
๐๐ gets into the running container named vish_cont
๐ป cat /sys/fs/cgroup/memory.max
๐๐ shows the output max memory in bytes
๐๐๐ divide the number by 1024*1024 to get in MB
๐น๐ฉ๐ฎ๐น๐ถ๐ฑ๐ฎ๐๐ถ๐ผ๐ป ๐ผ๐ณ ๐๐ฃ๐จ
๐ป docker exec -it vish_cont sh
๐๐ gets into the running container named vish_cont
๐ป cat /sys/fs/cgroup/cpu.max
๐๐ shows the output of the number of cores used
๐๐๐ divide the output first number with the second to get the number of cpu cores
3.๐ ๐๐ฟ๐ผ๐ป๐๐ฎ๐ฏ & ๐๐ฟ๐ผ๐ป ๐๐ ๐ฝ๐ฟ๐ฒ๐๐๐ถ๐ผ๐ป๐
๐ ๐๐ฟ๐ผ๐ป๐๐ฎ๐ฏ ๐
๐๐ crontab aka ๐ช๐๐๐ ๐ป๐๐๐๐ is a configuration file to schedule & automate tasks
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: crontab -l
๐๐ used to list the available cron jobs scheduled
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: crontab -e
๐๐ used to list the available cron jobs scheduled
๐ ๐๐ฟ๐ผ๐ป ๐๐
๐ฝ๐ฟ๐ฒ๐๐๐ถ๐ผ๐ป ๐ - Refer post picture to understand the expression
๐๐ visit the website to generate cron expression - https://crontab.guru/
4.๐ ๐ค๐๐ถ๐ฐ๐ธ๐น๐ ๐ฆ๐ฒ๐ฎ๐ฟ๐ฐ๐ต ๐๐ถ๐น๐ฒ๐/๐๐ผ๐น๐ฑ๐ฒ๐ฟ๐ ๐๐๐ถ๐ป๐ด ๐๐ผ๐ฐ๐ฎ๐๐ฒ ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ ๐
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: sudo apt install plocate
๐๐ install the plocate on debian based systems
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: updatedb
๐๐ updates the database that locate uses
๐๐๐ locate is faster because it uses this prebuilt database instead of filesystem
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: locate <file/folder pattern>
๐๐ used to quickly find location of files and directories
๐๐๐ returns the absolute path of the file/folder mentioned
๐๐๐๐ example: locate add.txt, locate *.tar
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: locate -i <file/folder pattern>
๐๐ case insenstive search
5.๐ข ๐ง๐ฒ๐ฟ๐ฟ๐ฎ๐ณ๐ผ๐ฟ๐บ ๐ฉ๐ฎ๐ฟ๐ถ๐ฎ๐ฏ๐น๐ฒ ๐ข๐ฟ๐ฑ๐ฒ๐ฟ ๐ผ๐ณ ๐ฃ๐ฟ๐ฒ๐ฐ๐ฒ๐ฑ๐ฒ๐ป๐ฐ๐ฒ ๐ข
Terraform variables take the following precedence:
๐น Environment Variables
๐๐ terraform environment variables starts with TF_VAR_<variableName>
๐น Variable Defaults
๐๐ variable blocks consisting the default value
๐น Terraform tfvars (terraform.tfvars)
๐๐ seperate file named terraform.tfvars with variables defined
๐น CLI (using -var and -var-file)
๐๐ passing variable name (-var=<varName=varValue>)
๐๐ passing variable filename (-var-file=<fileNmae>)
6.โจ๏ธ ๐ ๐ ๐ณ๐ฟ๐ฒ๐พ๐๐ฒ๐ป๐๐น๐ ๐๐๐ฒ๐ฑ ๐๐ถ ๐ฒ๐ฑ๐ถ๐๐ผ๐ฟ ๐ธ๐ฒ๐๐ฏ๐ผ๐ฎ๐ฟ๐ฑ ๐๐ต๐ผ๐ฟ๐๐ฐ๐๐๐ โจ๏ธ
๐ ๐๐๐ฟ๐๐ผ๐ฟ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป๐
๐นMove cursor to start of the line - "๐ด๐ด"
๐นMove cursor to end of the line - "๐๐ต๐ถ๐ณ๐ + ๐ด"
๐ ๐๐ถ๐ป๐ฑ & ๐ฅ๐ฒ๐ฝ๐น๐ฎ๐ฐ๐ฒ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป๐
๐นSearch for a pattern & move cursor to it - "/<๐๐ฒ๐ฎ๐ฟ๐ฐ๐ต๐ฃ๐ฎ๐๐๐ฒ๐ฟ๐ป>"
๐นFind & replace old text to new text - ":%๐/๐ผ๐น๐ฑ๐ง๐ฒ๐
๐/๐ป๐ฒ๐๐ง๐ฒ๐
๐"
๐ ๐๐ฒ๐น๐ฒ๐๐ฒ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป๐
๐นDelete the current line - "๐ฑ๐ฑ"
๐นDelete all contents of file - "๐ด๐ด ๐ฑ๐"
๐นDelete current line & next desired number of lines - "๐ฑ<๐ป๐๐บ๐ฏ๐ฒ๐ฟ๐ข๐ณ๐๐ถ๐ป๐ฒ๐>"
๐ ๐ ๐ถ๐๐ฐ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป๐
๐นUndo the operation - "๐"
๐นSet the line numbers - ":๐๐ฒ๐ ๐ป๐"
7.๐ ๏ธ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ ๐๐น๐ผ๐๐ฑ๐ช๐ฎ๐๐ฐ๐ต ๐๐น๐ฎ๐ฟ๐บ ๐ณ๐ผ๐ฟ ๐๐ฒ๐๐๐ถ๐ป๐ด ๐ ๏ธ
๐น ๐๐ผ๐บ๐บ๐ฎ๐ป๐ฑ: Using AWS CLI
๐๐ aws cloudwatch set-alarm-state --alarm-name "VishCPU_70" --state-value ALARM --state-reason "Testing Vish Alarm"
๐๐๐ This helps in quickly testing the alarm when the threshold is not reached.
๐๐๐๐ Sets the VishCPU_70 alarm to ALARM state and can send notifications based on the alarm configured.
๐๐
๐๐ฟ๐ฎ๐:
๐๐น๐ฎ๐ฟ๐บ ๐ฆ๐๐ฎ๐๐ฒ๐:
๐ข๐ ๐ฆ๐๐ฎ๐๐ฒ - alarm is within the threshold defined
๐๐๐๐ฅ๐ ๐ฆ๐๐ฎ๐๐ฒ - alarm crossed the threshold defined
๐๐ก๐ฆ๐จ๐๐๐๐๐๐๐ก๐ง_๐๐๐ง๐ ๐ฆ๐๐ฎ๐๐ฒ - Dont have much data to trigger the alarm
#DevOpsMiniBytes#VishDevOpsMiniBytes #CICD#ContinuousIntegration#ContinuousDeployment#ContinuosDelivery #DevOps#DevSecOps#GitOps#Agile#DevOpsCommunity #AWS#Cloud#Azure#GCP#CloudComputing#CloudNative #Monitoring#Observability#SRE#Prometheus#Grafana #Nexus#Ansible#GitHub#GitHubActions#GitLab #Docker#Kubernetes#K8s#CloudNative#Helm #Linux#Bash#Shell#Scripting#Automation #Jenkins#Pipeline#JenkinsFile#Groovy #OWASP#Trivy#DependencyScan #Java#Python#NodeJS#Gradle #Terraform#InfraProvisioning #BrainTuning



