modified: README.md
This commit is contained in:
72
README.md
72
README.md
@@ -11,14 +11,15 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
|
|||||||
- [OOMKilled](#oomkilled)
|
- [OOMKilled](#oomkilled)
|
||||||
- [Attach to an pod](#attach-to-an-pod)
|
- [Attach to an pod](#attach-to-an-pod)
|
||||||
- [Run command on pod](#run-command-on-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)
|
- [kubectl](#kubectl)
|
||||||
- [Helper pods](#helper-pods)
|
- [Helper pods](#helper-pods)
|
||||||
- [network testing](#network-testing)
|
- [network testing](#network-testing)
|
||||||
- [Set Replicas](#set-replicas)
|
- [Set Replicas](#set-replicas)
|
||||||
- [taint nodes](#taint-nodes)
|
|
||||||
- [control plane - NoSchedule](#control-plane---noschedule)
|
|
||||||
- [Resources](#resources)
|
- [Resources](#resources)
|
||||||
- [Persistent volumes claims](#persistent-volumes-claims)
|
|
||||||
- [Services Accounts](#services-accounts)
|
- [Services Accounts](#services-accounts)
|
||||||
- [Secrets](#secrets)
|
- [Secrets](#secrets)
|
||||||
- [Manifest - Opaque / Base64](#manifest---opaque--base64)
|
- [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)
|
- [Inline with heredoc and environment variables](#inline-with-heredoc-and-environment-variables)
|
||||||
- [substr](#substr)
|
- [substr](#substr)
|
||||||
- [nodes](#nodes)
|
- [nodes](#nodes)
|
||||||
|
- [taint nodes](#taint-nodes)
|
||||||
|
- [control plane - NoSchedule](#control-plane---noschedule)
|
||||||
- [Deployment](#deployment)
|
- [Deployment](#deployment)
|
||||||
- [Deployment - Set Replicas](#deployment---set-replicas)
|
- [Deployment - Set Replicas](#deployment---set-replicas)
|
||||||
- [Deployment - Restart](#deployment---restart)
|
- [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 /
|
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
|
||||||
|
|
||||||
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.
|
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 <deployment-name> \
|
|||||||
-p '{"spec":{"replicas":0}}'
|
-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
|
### Resources
|
||||||
|
|
||||||
**List all resources:**
|
**List all resources:**
|
||||||
@@ -299,17 +312,7 @@ kubectl get all -n kube-system | grep traefik
|
|||||||
kubectl get serviceAccount --all-namespaces
|
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
|
### Services Accounts
|
||||||
|
|
||||||
@@ -432,6 +435,15 @@ kubectl describe node <NODE_NAME> | grep taint
|
|||||||
kubectl annotate node <NODE_NAME> <ANNOTATION_NAME>-
|
kubectl annotate node <NODE_NAME> <ANNOTATION_NAME>-
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
### Deployment - Set Replicas
|
### Deployment - Set Replicas
|
||||||
|
|||||||
Reference in New Issue
Block a user