From b7a1bf3ce9a091cd5fdb98e1b673d99b9218d2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Fernandes?= Date: Sat, 28 Feb 2026 11:40:23 +0000 Subject: [PATCH] modified: README.md --- README.md | 72 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 4e39f59..e2d378b 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,15 @@ Kubernetes is an open‑source platform that automates the deployment, scaling, - [OOMKilled](#oomkilled) - [Attach to an pod](#attach-to-an-pod) - [Run command on pod](#run-command-on-pod) +- [Persistent volumes](#persistent-volumes) + - [find persistent volume used pvc](#find-persistent-volume-used-pvc) + - [Patch pv - change to retain policy](#patch-pv---change-to-retain-policy) + - [Patch pv - remove finalizers](#patch-pv---remove-finalizers) - [kubectl](#kubectl) - [Helper pods](#helper-pods) - [network testing](#network-testing) - [Set Replicas](#set-replicas) - - [taint nodes](#taint-nodes) - - [control plane - NoSchedule](#control-plane---noschedule) - [Resources](#resources) - - [Persistent volumes claims](#persistent-volumes-claims) - [Services Accounts](#services-accounts) - [Secrets](#secrets) - [Manifest - Opaque / Base64](#manifest---opaque--base64) @@ -26,6 +27,8 @@ Kubernetes is an open‑source platform that automates the deployment, scaling, - [Inline with heredoc and environment variables](#inline-with-heredoc-and-environment-variables) - [substr](#substr) - [nodes](#nodes) + - [taint nodes](#taint-nodes) + - [control plane - NoSchedule](#control-plane---noschedule) - [Deployment](#deployment) - [Deployment - Set Replicas](#deployment---set-replicas) - [Deployment - Restart](#deployment---restart) @@ -207,6 +210,33 @@ POD_NAME=$(kubectl get pod -l app=myAppName -n appNamespace -o jsonpath='{.items kubectl exec -it ${POD_NAME} -- ls / ``` +## Persistent volumes + +### find persistent volume used pvc + +``` bash +NAMESPACE=??? +PVC_NAME=??? +PV_NAME=$(kubectl get pvc $PVC_NAME -n $NAMESPACE -o jsonpath='{.spec.volumeName}') +echo "${PV_NAME}" +``` + +### Patch pv - change to retain policy + +``` bash +PV_NAME="???" +kubectl patch pv $PV_NAME \ + -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' +``` + +### Patch pv - remove finalizers + +``` bash +PV_NAME="???" +kubectl patch pv $PV_NAME \ + -p '{"metadata":{"finalizers": null}}' +``` + ## kubectl kubectl is the command‑line tool used to interact with Kubernetes clusters. Think of it as the “remote control” for Kubernetes: it lets you deploy applications, inspect resources, and manage cluster operations directly from your terminal. @@ -268,23 +298,6 @@ kubectl patch deployment \ -p '{"spec":{"replicas":0}}' ``` -**Set statefulset replicas to 0:** - -```bash -kubectl patch statefulset zigbee2mqtt \ - -n mqtt \ - -p '{"spec":{"replicas":1}}' -``` - -### taint nodes - -#### control plane - NoSchedule - -``` bash -MASTER_NODE_NAME="master-node-name" -kubectl taint nodes ${MASTER_NODE_NAME} node-role.kubernetes.io/control-plane=:NoSchedule -``` - ### Resources **List all resources:** @@ -299,17 +312,7 @@ kubectl get all -n kube-system | grep traefik kubectl get serviceAccount --all-namespaces ``` -### Persistent volumes claims -**Patch pvc to retain policy:** - -``` bash -PVC_NAME="????" -NAMESPACE="????" -PV_NAME= $(kubectl get pvc $PVC_NAME -n $NAMESPACE -o jsonpath='{.spec.volumeName}') -kubectl patch pv $PV_NAME \ - -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' -``` ### Services Accounts @@ -432,6 +435,15 @@ kubectl describe node | grep taint kubectl annotate node - ``` +### taint nodes + +#### control plane - NoSchedule + +``` bash +MASTER_NODE_NAME="master-node-name" +kubectl taint nodes ${MASTER_NODE_NAME} node-role.kubernetes.io/control-plane=:NoSchedule +``` + ## Deployment ### Deployment - Set Replicas