Helm/Yourls: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{|class='wikitable' style='width:100%;margin:-11px 0 6px 0'
{|class='wikitable'
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
helm repo add yourls https://charts.yourls.org
helm repo add yourls https://charts.yourls.org
helm repo update && helm repo list
helm repo update && helm repo list
Line 9: Line 9:


==Data==
==Data==
{|class='wikitable' style='width:100%;margin:3px 0'
{|class='wikitable'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Data
Data
|-
|-
|valign='top'|
|valign='top'|
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Data » HostPath
Data » HostPath
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
sudo su


cat <<'EXE'| sudo bash
cat <<'EXE'| sudo bash
     mkdir -p      /var/minikube/pvc/yourls/data-mariadb-0/
     mkdir -p      /var/minikube/pvc/yourls/data-mariadb-0/
chown -R 1001:1001 /var/minikube/pvc/yourls/
chown -R 1001:1001 /var/minikube/pvc/yourls/
sh    -c  'ls -alh /var/minikube/pvc/yourls/'
EXE
EXE
</syntaxhighlight>
</syntaxhighlight>
Line 32: Line 32:


|}
|}
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Data » MariaDB
Data » MariaDB
|-
|-
|valign='top'|
|valign='top'|
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
MariaDB » Create
MariaDB » Create
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
echo -n 'Password: ';read -s TOOL_YOURLS;export TOOL_YOURLS;echo
echo -n 'Password: ';read -s YOURLS_PASSWORD;export YOURLS_PASSWORD;echo
echo "${YOURLS_PASSWORD}"
# Password: sadaqah!
# Password: sadaqah!
</syntaxhighlight>
</syntaxhighlight>
Line 59: Line 60:
cat << DDL | sudo -i -u root mariadb
cat << DDL | sudo -i -u root mariadb
CREATE DATABASE IF NOT EXISTS shahed_tool_yourls;
CREATE DATABASE IF NOT EXISTS shahed_tool_yourls;
CREATE USER    IF NOT EXISTS shahed_tool_yourls@'%' IDENTIFIED BY '${TOOL_YOURLS}';
CREATE USER    IF NOT EXISTS shahed_tool_yourls@'%' IDENTIFIED BY '${YOURLS_PASSWORD}';
GRANT  ALL PRIVILEGES  ON    shahed_tool_yourls.*  TO  shahed_tool_yourls@'%';
GRANT  ALL PRIVILEGES  ON    shahed_tool_yourls.*  TO  shahed_tool_yourls@'%';
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
Line 65: Line 66:
</syntaxhighlight>
</syntaxhighlight>
|}
|}
{|class='wikitable mw-collapsible' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
MariaDB » Debug
MariaDB » Debug
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
echo -n 'Password: ';read -s MYSQL_PWD;export MYSQL_PWD;echo
echo -n 'Password: ';read -s MYSQL_PWD;export MYSQL_PWD;echo
# Password: sadaqah!
# Password: sadaqah!
Line 82: Line 83:
</syntaxhighlight>
</syntaxhighlight>
|}
|}
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
MariaDB » Backup
MariaDB » Backup
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
cd ~/Downloads
# cd ~/Downloads


function quarter() {
function quarter() {
Line 108: Line 109:
# Password: sadaqah!
# Password: sadaqah!


BKP_DATETIME="$(date +'%Y-%m-%dT%H%M')";\
BKP_DATE_N_TIME="$(date +'%Y-%m-%dT%H%M')";\
mariadb-dump -P3306 -h10.20.13.1 -u shahed_tool_yourls shahed_tool_yourls | gzip > shahed_tool_yourls.${BKP_DATETIME}.sql.gz
mariadb-dump -P3306 -h10.20.13.1 -u shahed_tool_yourls shahed_tool_yourls | gzip > shahed_tool_yourls.data.${BKP_DATE_N_TIME}.sql.gz
gunzip -c shahed_tool_yourls.data.${BKP_DATE_N_TIME}.sql.gz | more
</syntaxhighlight>
</syntaxhighlight>
|}
|}
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
MariaDB » Restore
MariaDB » Restore
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
mc cp s3_minio_shahed_shahed_biz_admin/shahed-bkp/tool/yourls/daily/2025-M12/2025-12-21/shahed_tool_yourls.2025-12-21T2345.sql.gz ${HOME}/Downloads/
# mc cp s3_minio_shahed_shahed_biz_admin/shahed-bkp/tool/yourls/daily/2025-M12/2025-12-21/shahed_tool_yourls.data.2025-12-21T2345.sql.gz ${HOME}/Downloads/


echo -n 'password: ';read -s MYSQL_PWD;export MYSQL_PWD; echo
echo -n 'password: ';read -s MYSQL_PWD;export MYSQL_PWD; echo
Line 125: Line 127:


mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
gunzip -c ${HOME}/Downloads/shahed_tool_yourls.2025-12-21T2345.sql.gz | mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
gunzip -c shahed_tool_yourls.data.2025-12-21T2345.sql.gz | mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
# gunzip -c ${HOME}/Downloads/shahed_tool_yourls.data.2025-12-21T2345.sql.gz | mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
</syntaxhighlight>
</syntaxhighlight>
|}
|}
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
MariaDB » Destroy
MariaDB » Destroy
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='sql'>
<syntaxhighlight lang='sql'>
ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
cat <<'DDL'| sudo -i -u root mariadb
cat <<'DDL'| sudo -i -u root mariadb
\! echo " "
\! echo " "
Line 148: Line 151:


==Config==
==Config==
{|class='wikitable' style='width:100%;margin:3px 0'
{|class='wikitable'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Config
Config
|-
|-
|valign='top'|
|valign='top'|
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Config » Context
Config » Context
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
export KUBECONFIG=${HOME}/.kube/shahed-ab-kubeconfig.yaml
export KUBECONFIG=${HOME}/.kube/shahed-ab-kubeconfig.yaml
kubectl config get-contexts
kubectl config get-contexts
Line 165: Line 168:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl config view -o=yaml|yq '.contexts[0].name'
kubectl config view -o=yaml|yq '.contexts[0].name'
kubectl create ns  yourls || true
kubectl create ns  yourls || true
Line 171: Line 174:
</syntaxhighlight>
</syntaxhighlight>
|}
|}
{|class='wikitable mw-collapsible' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Config » Yourls
Config » Yourls
|-
|-
|valign='top'|
|valign='top'|
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Yourls » Certificate
Yourls » Certificate
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls apply -f -
kubectl -n yourls apply -f -
Line 265: Line 268:
</syntaxhighlight>
</syntaxhighlight>
|}
|}
{|class='wikitable mw-collapsible' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Yourls » Secrect
Yourls » Secrect
|-
|-
|valign='top'|
|valign='top'|
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Secrect » MariaDB
Secrect » MariaDB
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
cat << ENV | \
cat << ENV | \
kubectl -n yourls \
kubectl -n yourls \
Line 287: Line 290:
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
|}
|}
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Secrect » Yourls
Secrect » Yourls
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
cat << ENV | \
cat << ENV | \
kubectl -n yourls \
kubectl -n yourls \
Line 304: Line 307:
|}
|}
|}
|}
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:6px 0 3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Yourls » Volume
Yourls » Volume
|-
|-
|colspan='2'|
|valign='top' style='width:50%'|
{|class='wikitable'
|valign='top'|
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]]
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]]
----
----
Line 314: Line 319:
----
----
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]]
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]]
 
|}
|valign='top' style='width:50%'|
|-
|-
|valign='top' style='width:50%'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='yaml' highlight='13-15'>
<syntaxhighlight lang='yaml' highlight='13-15'>
cat <<'YML'| \
cat <<'YML'| \
kubectl apply -f -
kubectl apply -f -
Line 338: Line 344:
YML
YML
</syntaxhighlight>
</syntaxhighlight>
|valign='top' style='width:50%'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='yaml' highlight='8,9,16,17'>
<syntaxhighlight lang='yaml' highlight='8,9,16,17'>
cat << YML | \
cat << YML | \
kubectl apply -f -
kubectl apply -f -
Line 365: Line 371:


==Helm » Upgrade==
==Helm » Upgrade==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Helm » Upgrade
Helm » Upgrade
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
helm show  values yourls/yourls --version=8.5.6|less
helm show  values yourls/yourls --version=8.5.6|less
helm show  values yourls/yourls --version=8.5.8|less
helm show  values yourls/yourls --version=8.5.8|less
Line 376: Line 382:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl create ns      yourls || true
kubectl create ns      yourls || true
kubectl get    ns|grep yourls
kubectl get    ns|grep yourls
Line 382: Line 388:
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
helm --history-max=5 -n=yourls \
helm --history-max=5 -n=yourls \
Line 466: Line 472:
|-
|-
|valign='top' colspan='2'|
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
telnet go.shahed.biz.ops 80
telnet go.shahed.biz.ops 80
setsid open http://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
setsid open http://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
Line 473: Line 479:


==Helm » Patch==
==Helm » Patch==
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Helm » Patch
Helm » Patch
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls patch ingress/yourls --patch-file=/dev/stdin
kubectl -n yourls patch ingress/yourls --patch-file=/dev/stdin
Line 495: Line 501:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls patch ingress/yourls --patch-file=/dev/stdin
kubectl -n yourls patch ingress/yourls --patch-file=/dev/stdin
Line 512: Line 518:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
setsid open  http://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
setsid open  http://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
setsid open https://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
setsid open https://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
Line 522: Line 528:


==Helm » Scale==
==Helm » Scale==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left' style='width:50%'|
!scope='col' style='text-align:left' style='width:50%'|
Yourls » Stop
Yourls » Stop
Line 529: Line 535:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
Line 539: Line 545:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
Line 550: Line 556:


==Helm » Debug==
==Helm » Debug==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Helm » Debug
Helm » Debug
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls exec -it svc/yourls -c yourls -- cat /etc/resolv.conf
kubectl -n yourls exec -it svc/yourls -c yourls -- cat /etc/resolv.conf
kubectl -n yourls exec -it svc/yourls -c yourls -- cat /etc/hosts
kubectl -n yourls exec -it svc/yourls -c yourls -- cat /etc/hosts
Line 564: Line 570:
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls exec -it svc/yourls -c yourls -- bash
kubectl -n yourls exec -it svc/yourls -c yourls -- bash
:'
:'
Line 575: Line 581:
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$name = "Yourls"; echo "Hello, {$name}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$name = "Yourls"; echo "Hello, {$name}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$time =  time() ; echo "Time : {$time}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$time =  time() ; echo "Time : {$time}\n";'
Line 587: Line 593:
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$timestamp = time();$signature = md5( $timestamp . "1002a612b4" ); echo "Signature: {$signature}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$timestamp = time();$signature = md5( $timestamp . "1002a612b4" ); echo "Signature: {$signature}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$signature = md5( time() . "1002a612b4" ); echo "Signature: {$signature}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$signature = md5( time() . "1002a612b4" ); echo "Signature: {$signature}\n";'
Line 593: Line 599:
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='php'>
<syntaxhighlight lang='php'>
echo; \
echo; \
cat <<'PHP' | kubectl -n yourls exec -i svc/yourls -c yourls -- php /dev/stdin | xargs curl -s | jq -r .shorturl
cat <<'PHP' | kubectl -n yourls exec -i svc/yourls -c yourls -- php /dev/stdin | xargs curl -s | jq -r .shorturl
Line 604: Line 610:
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='php'>
<syntaxhighlight lang='php'>
echo; \
echo; \
cat <<'PHP' | kubectl -n yourls exec -i svc/yourls -c yourls -- php /dev/stdin | xargs curl -s | jq -r .shorturl
cat <<'PHP' | kubectl -n yourls exec -i svc/yourls -c yourls -- php /dev/stdin | xargs curl -s | jq -r .shorturl
Line 616: Line 622:


==Helm » Rollout==
==Helm » Rollout==
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Yourls » Rollout
Yourls » Rollout
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls annotate        deploy/yourls --overwrite \
kubectl -n yourls annotate        deploy/yourls --overwrite \
  kubernetes.io/change-cause="CKI-1| Initial Deployment"
  kubernetes.io/change-cause="CKI-1| Initial Deployment"
Line 627: Line 633:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls rollout pause  deploy/yourls
kubectl -n yourls rollout pause  deploy/yourls
Line 640: Line 646:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
Line 660: Line 666:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='yaml'>
<syntaxhighlight lang='yaml'>
cat <<'YML' | \
cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
Line 680: Line 686:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls annotate        deploy/yourls --overwrite \
kubectl -n yourls annotate        deploy/yourls --overwrite \
  kubernetes.io/change-cause="CKI-2| Resources Updated"
  kubernetes.io/change-cause="CKI-2| Resources Updated"
Line 686: Line 692:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls rollout resume  deploy/yourls
kubectl -n yourls rollout resume  deploy/yourls
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls rollout history deploy/yourls
Line 692: Line 698:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls rollout undo    deploy/yourls --to-revision=1
kubectl -n yourls rollout undo    deploy/yourls --to-revision=1
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls rollout history deploy/yourls
Line 698: Line 704:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls annotate        deploy/yourls --overwrite \
kubectl -n yourls annotate        deploy/yourls --overwrite \
  kubernetes.io/change-cause="CKI-3| Revert Back to CKI-1"
  kubernetes.io/change-cause="CKI-3| Revert Back to CKI-1"
Line 704: Line 710:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls get deploy yourls -o yaml \
kubectl -n yourls get deploy yourls -o yaml \
  | yq -P '.spec.template.spec.containers[]|select(.name == "yourls")|.resources'
  | yq -P '.spec.template.spec.containers[]|select(.name == "yourls")|.resources'
Line 710: Line 716:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls get deploy yourls \
kubectl -n yourls get deploy yourls \
   -o jsonpath='{.spec.template.spec.containers[?(@.name=="yourls")].resources}' | yq -P
   -o jsonpath='{.spec.template.spec.containers[?(@.name=="yourls")].resources}' | yq -P
Line 717: Line 723:


==Helm » Uninstall==
==Helm » Uninstall==
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left'|
!scope='col' style='text-align:left'|
Helm » Uninstall
Helm » Uninstall
|-
|-
|valign='top'|
|valign='top'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl delete ns          yourls
kubectl delete ns          yourls
helm    -n yourls status    yourls
helm    -n yourls status    yourls
Line 734: Line 740:


==Playground==
==Playground==
{|class='wikitable mw-collapsible mw-collapsed' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible mw-collapsed'
!scope='col' style='text-align:left' colspan='2'|
!scope='col' style='text-align:left' colspan='2'|
Playground
Playground
|-
|-
|valign='top' colspan='2'|
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
helm -n yourls install    yourls yourls/yourls --version=8.5.6
helm -n yourls install    yourls yourls/yourls --version=8.5.6
helm -n yourls upgrade -i yourls yourls/yourls --version=8.5.8
helm -n yourls upgrade -i yourls yourls/yourls --version=8.5.8
Line 746: Line 752:
|-
|-
|valign='top' colspan='2'|
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-replication-password"'|base64 -d && echo
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-replication-password"'|base64 -d && echo
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-root-password"'      |base64 -d && echo
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-root-password"'      |base64 -d && echo
Line 760: Line 766:
|-
|-
|valign='top' colspan='2'|
|valign='top' colspan='2'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
Line 768: Line 774:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls delete all --all
kubectl -n yourls delete all --all
kubectl -n yourls delete ing --all
kubectl -n yourls delete ing --all
Line 775: Line 781:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl    delete pv    yourls-data-mariadb-0
kubectl    delete pv    yourls-data-mariadb-0
kubectl -n yourls delete svc --all
kubectl -n yourls delete svc --all
Line 783: Line 789:
|-
|-
|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls rollout history deploy yourls
kubectl -n yourls rollout history deploy yourls
kubectl -n yourls rollout restart deploy yourls
kubectl -n yourls rollout restart deploy yourls
Line 790: Line 796:


|valign='top' style='width:50%'|
|valign='top' style='width:50%'|
<syntaxhighlight style='margin:3px 0' lang='bash'>
<syntaxhighlight lang='bash'>
kubectl -n yourls exec -it svc/yourls -c yourls -- ash
kubectl -n yourls exec -it svc/yourls -c yourls -- ash
kubectl -n yourls logs -f  svc/yourls -c yourls
kubectl -n yourls logs -f  svc/yourls -c yourls
Line 798: Line 804:


==References==
==References==
{|class='wikitable mw-collapsible' style='width:100%;margin:3px 0'
{|class='wikitable mw-collapsible'
!scope='col' style='text-align:left' colspan='3'|
!scope='col' style='text-align:left' colspan='3'|
References
References

Latest revision as of 12:39, 27 January 2026

helm repo add yourls https://charts.yourls.org
helm repo update && helm repo list
kubectl config get-contexts

Data

Data

Data » HostPath

# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash

cat <<'EXE'| sudo bash
    mkdir -p       /var/minikube/pvc/yourls/data-mariadb-0/
chown -R 1001:1001 /var/minikube/pvc/yourls/
sh    -c  'ls -alh /var/minikube/pvc/yourls/'
EXE

Data » MariaDB

MariaDB » Create

# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
echo -n 'Password: ';read -s YOURLS_PASSWORD;export YOURLS_PASSWORD;echo
echo "${YOURLS_PASSWORD}"
# Password: sadaqah!
cat <<'SQL'| sudo -i -u root mariadb
\! echo " "
SELECT concat(user, '@', host) AS 'user\n+--------------------------+' FROM mysql.user ORDER BY 1 ASC;
\! echo " "
-- SHOW databases;
SELECT schema_name         AS 'database\n+--------------------------+' FROM information_schema.schemata ORDER BY 1 ASC;
SQL
cat << DDL | sudo -i -u root mariadb
CREATE DATABASE IF NOT EXISTS shahed_tool_yourls;
CREATE USER     IF NOT EXISTS shahed_tool_yourls@'%' IDENTIFIED BY '${YOURLS_PASSWORD}';
GRANT  ALL PRIVILEGES  ON     shahed_tool_yourls.*   TO  shahed_tool_yourls@'%';
FLUSH PRIVILEGES;
DDL

MariaDB » Debug

echo -n 'Password: ';read -s MYSQL_PWD;export MYSQL_PWD;echo
# Password: sadaqah!

sudo -i -u root \
mariadb -D shahed_tool_yourls
mariadb -D shahed_tool_yourls -u shahed_tool_yourls
mariadb -D shahed_tool_yourls -u shahed_tool_yourls -P3306 -h10.20.0.1
mariadb -D shahed_tool_yourls -u shahed_tool_yourls -P3306 -h10.20.13.1
mariadb -D shahed_tool_yourls -u shahed_tool_yourls -P3306 -h192.168.49.1

MariaDB » Backup

# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# cd ~/Downloads

function quarter() {
 local month this_quarter
 local month=$(date +%m)

 case ${month} in
   01|02|03) this_quarter="$(date +'%Y-01-01')" ;;
   04|05|06) this_quarter="$(date +'%Y-04-01')" ;;
   07|08|09) this_quarter="$(date +'%Y-07-01')" ;;
   10|11|12) this_quarter="$(date +'%Y-10-01')" ;;
 esac

 echo -n "${this_quarter}"
}

echo -n 'password: ';read -s MYSQL_PWD;export MYSQL_PWD; echo
# Password: sadaqah!

BKP_DATE_N_TIME="$(date +'%Y-%m-%dT%H%M')";\
mariadb-dump -P3306 -h10.20.13.1 -u shahed_tool_yourls shahed_tool_yourls | gzip > shahed_tool_yourls.data.${BKP_DATE_N_TIME}.sql.gz
gunzip -c shahed_tool_yourls.data.${BKP_DATE_N_TIME}.sql.gz | more

MariaDB » Restore

# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
# mc cp s3_minio_shahed_shahed_biz_admin/shahed-bkp/tool/yourls/daily/2025-M12/2025-12-21/shahed_tool_yourls.data.2025-12-21T2345.sql.gz ${HOME}/Downloads/

echo -n 'password: ';read -s MYSQL_PWD;export MYSQL_PWD; echo
# Password: sadaqah!

mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
gunzip -c shahed_tool_yourls.data.2025-12-21T2345.sql.gz | mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls
# gunzip -c ${HOME}/Downloads/shahed_tool_yourls.data.2025-12-21T2345.sql.gz | mariadb -P3306 -h10.20.13.1 -u shahed_tool_yourls -D shahed_tool_yourls

MariaDB » Destroy

# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash
cat <<'DDL'| sudo -i -u root mariadb
\! echo " "
REVOKE ALL PRIVILEGES ON  shahed_tool_yourls.* FROM shahed_tool_yourls@'%';
DROP DATABASE IF  EXISTS  shahed_tool_yourls;
DROP USER     IF  EXISTS  shahed_tool_yourls@'%';
FLUSH PRIVILEGES;
DDL

Config

Config

Config » Context

export KUBECONFIG=${HOME}/.kube/shahed-ab-kubeconfig.yaml
kubectl config get-contexts
kubectl config view
kubectl config view -o=yaml|yq '.contexts[0].name'
kubectl create ns   yourls || true
kubectl get ns|grep yourls

Config » Yourls

Yourls » Certificate

cat <<'YML' | \
kubectl -n yourls apply -f -
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: yourls-cert
  namespace: yourls
spec:
  secretName: yourls-cert
  commonName: go.shahed.biz.ops
  dnsNames:
    - go.shahed.biz.ops
  duration: 8760h
  renewBefore: 720h
  privateKey:
    size: 256
    encoding: PKCS8
    algorithm: ECDSA
    rotationPolicy: Always
  usages:
    - digital signature
    - key encipherment
    - server auth
    - client auth
  subject:
    countries: ["BD"]
    provinces: ["Dhaka"]
    postalCodes: ["1500"]
    localities: ["Munshiganj"]
    organizations: ["Shahed, Inc."]
    organizationalUnits: ["go.shahed.biz.ops"]
    streetAddresses: ["256 Khal East, Passport Office"]
  issuerRef:
    name: shahed-ecc-sub-ca-2025-k8s
    kind: ClusterIssuer
YML
cat <<'CRT' | \
sudo tee /usr/local/share/ca-certificates/Shahed_ECC_Root_CA_2025.crt >/dev/null
-----BEGIN CERTIFICATE-----
MIICVzCCAf0CFGUKRHOSLD3pqFU50HJvLeqYUPq6MAoGCCqGSM49BAMCMIGtMQsw
CQYDVQQGEwJCRDEOMAwGA1UECAwFRGhha2ExEzARBgNVBAcMCk11bnNoaWdhbmox
FTATBgNVBAoMDFNoYWhlZCwgSW5jLjEgMB4GA1UECwwXU2hhaGVkX0VDQ19Sb290
X0NBXzIwMjUxIDAeBgNVBAMMF1NoYWhlZF9FQ0NfUm9vdF9DQV8yMDI1MR4wHAYJ
KoZIhvcNAQkBFg9pbmZvQHNoYWhlZC5iaXowHhcNMjUwODIzMDk1NzMxWhcNNDUw
ODIzMDk1NzMxWjCBrTELMAkGA1UEBhMCQkQxDjAMBgNVBAgMBURoYWthMRMwEQYD
VQQHDApNdW5zaGlnYW5qMRUwEwYDVQQKDAxTaGFoZWQsIEluYy4xIDAeBgNVBAsM
F1NoYWhlZF9FQ0NfUm9vdF9DQV8yMDI1MSAwHgYDVQQDDBdTaGFoZWRfRUNDX1Jv
b3RfQ0FfMjAyNTEeMBwGCSqGSIb3DQEJARYPaW5mb0BzaGFoZWQuYml6MFkwEwYH
KoZIzj0CAQYIKoZIzj0DAQcDQgAEbuTaY9T08dgixHd9zvDCfuVODsZJDLcdpNB1
38haHzpnfsl0fvKVfJP1nYwrKwskBDTWPDYC03nIHJJxi9js+TAKBggqhkjOPQQD
AgNIADBFAiBUPr4rlKCuAD6FnoyZd/XKD/PvbzafUd4ZnRPFvSw3gQIhAMI+5v7a
ea5K8PaGppAIi/55yHqYlXLgaMB4ohu3OsGw
-----END CERTIFICATE-----
CRT

sudo update-ca-certificates --fresh
sudo update-ca-certificates
Shahed_ECC_Root_CA_2025 » Firefox » Settings » Certificates » View Certificates » Import
kubectl -n  cert-manager rollout restart deployment cert-manager-webhook
kubectl get ValidatingWebhookConfiguration          cert-manager-webhook
kubectl -n yourls get    Secret      yourls-cert -o=yaml
kubectl -n yourls get    Certificate yourls-cert -o=yaml
kubectl -n yourls delete Secret      yourls-cert -o=yaml
kubectl -n yourls delete Certificate yourls-cert -o=yaml

Yourls » Secrect

Secrect » MariaDB

cat << ENV | \
kubectl -n yourls \
 create secret generic yourls-mariadb --from-env-file=/dev/stdin \
 --dry-run=client -o=yaml | kubectl -n yourls apply -f -
mariadb-replication-password=sadaqah!
mariadb-root-password=sadaqah!
mariadb-password=sadaqah!
ENV

Secrect » Yourls

cat << ENV | \
kubectl -n yourls \
 create secret generic yourls --from-env-file=/dev/stdin \
 --dry-run=client -o=yaml | kubectl -n yourls apply -f -
password=sadaqah!
username=admin
ENV

Yourls » Volume



cat <<'YML'| \
kubectl apply -f -

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: yourls-data-mariadb-0
spec:
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  storageClassName: hostpath
  hostPath:
    path: /var/hostpath_pv/yourls/data-mariadb-0
    type: DirectoryOrCreate
YML
cat << YML | \
kubectl apply -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app.kubernetes.io/name: yourls
  name: data-mariadb-0
  namespace: yourls
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: hostpath
  volumeName: yourls-data-mariadb-0
YML

Helm » Upgrade

Helm » Upgrade

helm show   values yourls/yourls --version=8.5.6|less
helm show   values yourls/yourls --version=8.5.8|less
kubectl create ns      yourls || true
kubectl get    ns|grep yourls
cat <<'YML' | \
helm --history-max=5 -n=yourls \
 upgrade -i yourls yourls/yourls --version=8.5.8 -f -
---
replicaCount: 1
nameOverride: ops
fullnameOverride: yourls
revisionHistoryLimit: 5

image:
  tag: 1.10.2
  registry: ghcr.io
  repository: yourls/yourls

service:
  type: ClusterIP

yourls:
  scheme: https
  skipInstall: true
  existingSecret: yourls
  domain: go.shahed.biz.ops

ingress:
  enabled: true
  ingressClassName: nginx
  pathType: ImplementationSpecific
  annotations:
    kubernetes.io/tls-acme: "false"
    kubernetes.io/ingress.class: nginx
  hostname: go.shahed.biz.ops
  path: /

resources:
  requests:
    cpu: 50m
    memory: 64Mi
  limits:
    cpu: 100m
    memory: 128Mi

mariadb:
  enabled: false
  architecture: standalone
  image:
    registry: docker.io
    repository: bitnamilegacy/mariadb
    tag: 10.11.9

  auth:
    database: shahed_tool_yourls
    username: shahed_tool_yourls
    existingSecret: yourls-mariadb

  primary:
    persistence:
      size: 1Gi
      enabled: true
      accessModes:
        - ReadWriteOnce
      storageClass: hostpath
      existingClaim: data-mariadb-0

    resources:
      requests:
        cpu: 50m
        memory: 64Mi
      limits:
        cpu: 100m
        memory: 128Mi

externalDatabase:
  port: 3306
  host: 192.168.49.1
  user: shahed_tool_yourls
  database: shahed_tool_yourls
  existingSecret: yourls-mariadb
YML
telnet go.shahed.biz.ops 80
setsid open http://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &

Helm » Patch

Helm » Patch

cat <<'YML' | \
kubectl -n yourls patch ingress/yourls --patch-file=/dev/stdin
---
metadata:
  annotations:
    cert-manager.io/cluster-issuer: shahed-ecc-sub-ca-2025-k8s
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  tls:
    - hosts:
        - go.shahed.biz.ops
      secretName: yourls-cert
YML
cat <<'YML' | \
kubectl -n yourls patch ingress/yourls --patch-file=/dev/stdin
---
metadata:
  annotations:
    cert-manager.io/cluster-issuer: null
    nginx.ingress.kubernetes.io/ssl-redirect: null
spec:
  tls: null



YML
setsid open  http://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &
setsid open https://go.shahed.biz.ops/admin/ >/dev/null 2>&1 &

Helm » Scale

Yourls » Stop

Yourls » Start

cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
---
spec:
  replicas: 0
YML
cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
---
spec:
  replicas: 1
YML

Helm » Debug

Helm » Debug

kubectl -n yourls exec -it svc/yourls -c yourls -- cat /etc/resolv.conf
kubectl -n yourls exec -it svc/yourls -c yourls -- cat /etc/hosts
kubectl -n yourls exec -it svc/yourls -c yourls -- bash
kubectl -n yourls logs -f  svc/yourls -c yourls
kubectl -n yourls logs -f  svc/yourls
kubectl -n yourls exec -it svc/yourls -c yourls -- bash
:'
export MYSQL_PWD=$(cat /opt/bitnami/mariadb/secrets/mariadb-password)
mariadb -D shahed_tool_yourls -u shahed_tool_yourls
show databases;
show tables;
'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$name = "Yourls"; echo "Hello, {$name}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$time =  time() ; echo "Time : {$time}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -a
:'
php > echo time();
1766766506
php > 
'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$timestamp = time();$signature = md5( $timestamp . "1002a612b4" ); echo "Signature: {$signature}\n";'
kubectl -n yourls exec -it svc/yourls -c yourls -- php -r '$signature = md5( time() . "1002a612b4" ); echo "Signature: {$signature}\n";'
echo; \
cat <<'PHP' | kubectl -n yourls exec -i svc/yourls -c yourls -- php /dev/stdin | xargs curl -s | jq -r .shorturl
<?php
$timestamp = time();
$signature = md5( $timestamp . '1002a612b4' );
echo "https://go.shahed.biz.ops/yourls-api.php?signature={$signature}&timestamp={$timestamp}&action=shorturl&format=json&url=https://google.com";
PHP
echo; \
cat <<'PHP' | kubectl -n yourls exec -i svc/yourls -c yourls -- php /dev/stdin | xargs curl -s | jq -r .shorturl
<?php
$timestamp = time();
$signature = hash( 'sha256' , $timestamp . '1002a612b4' );
echo "https://go.shahed.biz.ops/yourls-api.php?signature={$signature}&timestamp={$timestamp}&hash=sha256&action=shorturl&format=json&url=https://google.com";
PHP

Helm » Rollout

Yourls » Rollout

kubectl -n yourls annotate        deploy/yourls --overwrite \
 kubernetes.io/change-cause="CKI-1| Initial Deployment"
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls rollout pause   deploy/yourls

Yourls » Rollout

Yourls » Revert

cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
---
spec:
  template:
    spec:
      containers:
        - name: yourls
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 200m
              memory: 256Mi
YML
cat <<'YML' | \
kubectl -n yourls patch deploy/yourls --patch-file=/dev/stdin
---
spec:
  template:
    spec:
      containers:
        - name: yourls
          resources:
            requests:
              cpu: 50m
              memory: 64Mi
            limits:
              cpu: 100m
              memory: 128Mi
YML
kubectl -n yourls annotate        deploy/yourls --overwrite \
 kubernetes.io/change-cause="CKI-2| Resources Updated"
kubectl -n yourls rollout resume  deploy/yourls
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls rollout undo    deploy/yourls --to-revision=1
kubectl -n yourls rollout history deploy/yourls
kubectl -n yourls annotate        deploy/yourls --overwrite \
 kubernetes.io/change-cause="CKI-3| Revert Back to CKI-1"
kubectl -n yourls get deploy yourls -o yaml \
 | yq -P '.spec.template.spec.containers[]|select(.name == "yourls")|.resources'
kubectl -n yourls get deploy yourls \
  -o jsonpath='{.spec.template.spec.containers[?(@.name=="yourls")].resources}' | yq -P

Helm » Uninstall

Helm » Uninstall

kubectl delete ns           yourls
helm    -n yourls status    yourls
helm    -n yourls get all   yourls
helm    -n yourls uninstall yourls

kubectl -n yourls  delete pvc --all
kubectl delete pv yourls-data-mariadb-0

Playground

Playground

helm -n yourls install    yourls yourls/yourls --version=8.5.6
helm -n yourls upgrade -i yourls yourls/yourls --version=8.5.8
helm show   values yourls/yourls --version=8.5.8|less
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-replication-password"'|base64 -d && echo
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-root-password"'       |base64 -d && echo
kubectl -n yourls get  secret  yourls-mariadb -o json|jq -r '.data."mariadb-password"'            |base64 -d && echo

kubectl -n yourls get  secret  yourls -o json|jq -r '.data.username'|base64 -d && echo
kubectl -n yourls get  secret  yourls -o json|jq -r '.data.password'|base64 -d && echo

kubectl -n yourls exec -it svc/yourls -c yourls -- bash
kubectl -n yourls logs -f  svc/yourls -c yourls
kubectl -n yourls logs -f  svc/yourls
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
kubectl -n yourls delete all --all
kubectl -n yourls delete ing --all
kubectl -n yourls delete sts --all
kubectl    delete pv     yourls-data-mariadb-0
kubectl -n yourls delete svc --all
kubectl -n yourls delete pvc --all
kubectl -n yourls rollout history deploy yourls
kubectl -n yourls rollout restart deploy yourls
kubectl -n yourls rollout status  deploy yourls
kubectl -n yourls exec -it svc/yourls -c yourls -- ash
kubectl -n yourls logs -f  svc/yourls -c yourls
kubectl -n yourls logs -f  svc/yourls

References

References