Monday, January 19, 2026

Windows 2016 - Install AZ CLI & KUBECTL



#AZ CLI
msiexec /i https://aka.ms/installazurecliwindows

#Kubectl
curl.exe -LO "https://dl.k8s.io/release/v1.30.1/bin/windows/amd64/kubectl.exe"
kubectl version --client

az login --use-device-code


Thursday, February 6, 2025

Ubuntu - Install K9S




wget https://github.com/derailed/k9s/releases/latest/download/k9s_linux_amd64.deb

sudo apt install ./k9s_linux_amd64.deb

rm k9s_linux_amd64.deb


Monday, January 1, 2024

Ubuntu - Install trivy image scanner

How to Install Trivy Image Scanner on Ubuntu (Step-by-Step Guide)

Trivy is a popular open-source vulnerability scanner used in DevSecOps pipelines to scan container images, file systems, and Kubernetes clusters. This guide shows how to install Trivy on Ubuntu using the official APT repository and run image vulnerability scans.


Table of Contents


What is Trivy?

Trivy is a simple and comprehensive vulnerability scanner for containers. It detects vulnerabilities in OS packages and application dependencies before deployment.

Why Use Trivy on Ubuntu?

  • Easy installation
  • Fast vulnerability scanning
  • Widely used in CI/CD pipelines
  • Supports Docker, Kubernetes, and filesystems

Remove Snap-installed Trivy (Recommended)

If Trivy was installed using Snap, remove it to avoid conflicts:


sudo snap remove trivy
which trivy

Install Trivy on Ubuntu Using Official APT Repository


sudo apt-get install -y wget gnupg lsb-release

wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | \
sudo gpg --dearmor -o /usr/share/keyrings/trivy.gpg

echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] \
https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | \
sudo tee /etc/apt/sources.list.d/trivy.list

sudo apt update
sudo apt install -y trivy

Verify Trivy Installation


trivy --version
/usr/bin/trivy --version

Scan Docker Image Using Trivy

Full Vulnerability Scan


/usr/bin/trivy image sparkaks2:latest

Only Vulnerability Scan


/usr/bin/trivy image --scanners vuln --timeout 15m sparkaks2:latest

Only OS Package Scan


/usr/bin/trivy image --vuln-type os sparkaks2:latest

Frequently Asked Questions (FAQ)

Is Trivy free to use?

Yes, Trivy is open-source and free for vulnerability scanning.

Does Trivy support Kubernetes?

Yes, Trivy can scan Kubernetes clusters and manifests.

Which Ubuntu versions are supported?

Ubuntu 18.04, 20.04, 22.04, and newer.


Related Guides:
More DevOps & Azure Tutorials

Sunday, October 1, 2023

apt-key warning when sudo apt update run



Issue: apt-key warning when sudo apt update run

Update below file:
cat /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list
sudo apt-key list
apt-key export 0EBFCD88 | sudo gpg --dearmour -o /usr/share/keyrings/docker.gpg
#edit file
sudo vim /etc/apt/sources.list.d/download_docker_com_linux_ubuntu.list

#from
deb https://download.docker.com/linux/ubuntu focal stable

#to
deb [arch=amd64 signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable

This should resolve issue.

Friday, September 1, 2023

Elasticsearch Index Red / Yellow



Issue: Elasticsearch Index Red / Yellow

Connect to Stack management in kibana:
Kibana -> DevTools
# Get cluster health
GET _cluster/health

# Get Index helath - Look for the red/yellow index
GET /_cat/indices

# Update number_of_replicas to 0.
PUT /.ds-logs-apm.error-default-2023.10.06-000002/_settings
{
  "number_of_replicas": 0
}

#This will change for all index with this patent
PUT /.ds-traces-apm-default-2023*/_settings
{
  "number_of_replicas": 0
}

This should resolve issue.

Wednesday, March 1, 2023

How to use tmux



Select current value



1. Create a new tmux session

tmux new -s logjob

2. Run your job inside tmux

tail -f /var/log/syslog

3. Disconnect (detach) from the tmux session

Ctrl + b, then d

4. List tmux sessions (optional)

tmux ls

5. Reconnect (attach) to the session

tmux attach -t logjob

6. Kill the session when done

tmux kill-session -t logjob

7. Create session and run job in one command

tmux new -s logjob "python log_job.py"

8. Detach from outside (if attached elsewhere)

tmux detach -s logjob



Wednesday, July 27, 2022

logrotate is not rotating logs



Issue: logrotate is not rotating logs files

logrotate update below file, let's start with this file:
cat /var/lib/logrotate/status
logrotate state -- version 2
"/var/log/ufw.log" 2022-3-20-6:25:1
"/var/log/nginx/web_xxx.access.log" 2022-3-23-6:25:1
"/var/log/nginx/access.log" 2018-8-2-21:0:0
"/var/log/apt/history.log" 2021-11-8-6:25:1
"/var/log/user.log" 2022-3-23-6:0:0


We can see some of the logs are rotating but not all so let's run logrotate in debug mode and look for the error if any
sudo /usr/sbin/logrotate -d /etc/logrotate.conf
compressing log with: /bin/gzip
renaming /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.2.gz to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.3.gz (rotatecount 2, logstart 1, i 2),
renaming /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.1.gz to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.2.gz (rotatecount 2, logstart 1, i 1),
renaming /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.0.gz to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.1.gz (rotatecount 2, logstart 1, i 0),
copying /home/deployer/apps/api_abc_co/shared/log/sidekiq.log to /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.1
truncating /home/deployer/apps/api_abc_co/shared/log/sidekiq.log
removing old log /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.3.gz
error: error opening /home/deployer/apps/api_abc_co/shared/log/sidekiq.log.3.gz: No such file or directory


it's failing as it's unable to create a file. it's a bug. manually create a file and re-run logrotate in debug mode and fix all the errors.


This should resolve issue.

Windows 2016 - Install AZ CLI & KUBECTL

#AZ CLI msiexec /i https://aka.ms/installazurecliwindows #Kubectl curl.exe -LO "https://dl.k8s.io/release/v1.30.1/bin/windows/amd64...