chore: 清理调试脚本并收敛到 Ansible 流程

移除已废弃的调试/验证脚本与空目录,统一文档与脚本说明到 ansible-playbook 的部署方式,避免失效引用和误用路径。

Made-with: Cursor
This commit is contained in:
2026-03-23 19:18:55 +08:00
parent 8a54cac61f
commit be97836e0d
92 changed files with 3463 additions and 4855 deletions

View File

@@ -1,38 +1,39 @@
# docs/03-05-k3s-local-path-pvc.md
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: local-pvc-demo
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
apiVersion: v1 # PVCKubernetes 核心 API
kind: PersistentVolumeClaim # 持久卷声明(你“申请要用的存储”)
metadata: # PVC 的元信息(名称/命名空间/其它元数据)
name: local-pvc-demo # PVC 名称Deployment 里会引用)
namespace: default # PVC 所在命名空间
spec: # PVC 的期望状态(访问模式/存储类/容量请求)
accessModes: # 访问模式RWO 表示同一时刻只能被一个节点上的一个 Pod 以读写方式挂载
- ReadWriteOnce # 读写模式:单节点可读写
storageClassName: local-path # 指定存储类:使用 K3s 的 local-path-provisioner动态创建本地 PV
resources: # 资源请求(本例只关心 storage 容量)
requests: # 容量配额请求(与 requests.storage 对应)
storage: 1Gi # 申请容量大小K8s quantity常见后缀 Ki/Mi/Gi/Ti/…示例512Mi、1024Mi、1Gi、1G也可写字节值
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-local-pvc-demo
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx-local-pvc-demo
template:
metadata:
labels:
app: nginx-local-pvc-demo
spec:
containers:
- name: nginx
image: nginx:alpine
volumeMounts:
- name: data
mountPath: /usr/share/nginx/html
volumes:
- name: data
persistentVolumeClaim:
claimName: local-pvc-demo
apiVersion: apps/v1 # Deploymentapps API
kind: Deployment # 部署器:管理 Pod 副本、滚动更新等
metadata: # Deployment 的元信息
name: nginx-local-pvc-demo # Deployment 名称
namespace: default # 部署到的命名空间Deployment 里引用 PVC 时也必须同 namespace
spec: # Deployment 的期望状态副本数、选择器、Pod 模板等)
replicas: 1 # Pod 副本数(用于验证持久化,保持单副本更直观)
selector: # Deployment 选择器:用于匹配/管理模板 Pod
matchLabels: # 标签匹配集合(必须与 template.metadata.labels 对上)
app: nginx-local-pvc-demo # Deployment 用该 label 选择/管理自己的 Pod
template: # Pod 模板Deployment 用它创建/更新 Pod
metadata: # Pod 元信息
labels: # Pod 标签:必须与 selector.matchLabels 对齐
app: nginx-local-pvc-demo # Pod 模板 label必须与 selector.matchLabels 对上
spec: # Pod 规范
containers: # 容器列表
- name: nginx # 容器名
image: nginx:alpine # nginx 镜像
volumeMounts: # 容器内挂载点(把卷挂到 mountPath
- name: data # 与下方 volumes[].name 对应:挂载哪个卷
mountPath: /usr/share/nginx/html # 挂载点:写入此目录会落到 PVC/PV 上
volumes: # Pod 内定义的卷列表
- name: data # Pod 内的卷名(给 volumeMounts 用)
persistentVolumeClaim: # 使用 PVC 作为卷来源
claimName: local-pvc-demo # 绑定到哪个 PVC必须与上面 PVC metadata.name 且同 namespace