Remove blank lines after code block markers

This commit is contained in:
yeasy
2026-03-21 22:36:09 -07:00
parent 312f8fea42
commit 9ac19d79ee
132 changed files with 0 additions and 1517 deletions

View File

@@ -48,7 +48,6 @@ control-plane Ready control-plane 10d v1.35.1
worker-1 Ready <none> 10d v1.35.1
worker-2 Ready <none> 10d v1.35.1
```
每个节点的详细信息以如下结构保存
```yaml
@@ -66,7 +65,6 @@ status:
- type: Ready
status: "True"
```
#### 节点控制器
Kubernetes 控制平面中节点控制器 (Node Controller) 负责管理节点的生命周期主要包含
@@ -77,14 +75,12 @@ status:
节点控制器会持续监控节点的健康状态当节点变为不可达时控制器会等待一个超时期限然后将该节点上的 Pod 标记为失败并触发重新调度可以使用 `kubectl` 来管理节点例如标记节点为不可调度或排空节点上的工作负载
```bash
## 标记节点为不可调度
$ kubectl cordon worker-1
## 排空节点上的 Pod
$ kubectl drain worker-1 --ignore-daemonsets
```
### 13.2.2 容器组
Kubernetes 使用的最小调度单位是容器组 (Pod)它是创建调度管理的最小单位一个 Pod 包含一个或多个紧密协作的容器它们共享网络命名空间和存储卷
@@ -172,7 +168,6 @@ spec:
ports:
- containerPort: 80
```
Deployment 的核心能力包括
* **副本管理**确保始终有指定数量的 Pod 在运行
@@ -198,7 +193,6 @@ spec:
targetPort: 80
type: ClusterIP
```
常见的 Service 类型
| 类型 | 说明 |
@@ -225,14 +219,12 @@ spec:
标签 (Label) 是附加到 Kubernetes 对象上的键值对用于组织和选择对象子集标签是 Kubernetes 中实现松耦合的关键机制
```bash
## 为 Pod 添加标签
$ kubectl label pod my-pod env=production
## 通过标签选择器查询
$ kubectl get pods -l env=production
```
ServiceDeployment 等资源都通过标签选择器 (`selector`) 来关联目标 Pod
### 13.2.7 API 访问控制
@@ -252,7 +244,6 @@ Kubernetes Dashboard 是一个基于 Web 的用户界面,用于部署容器化
`kubectl` Kubernetes 的命令行工具用于与集群进行交互常用命令如下
```bash
## 查看集群中的资源
$ kubectl get pods,deployments,services,nodes
@@ -268,5 +259,4 @@ $ kubectl exec -it my-pod -- /bin/sh
## 查看资源详情
$ kubectl describe pod my-pod
```
更多 kubectl 操作详见[kubectl 命令行](../14_kubernetes_setup/14.8_kubectl.md)章节

View File

@@ -52,7 +52,6 @@ spec:
type: Utilization
averageUtilization: 50
```
### 13.4.5 ConfigMap Secret
* **ConfigMap**存储非机密的配置数据 (配置文件环境变量)

View File

@@ -35,13 +35,11 @@ spec:
ports:
- containerPort: 80
```
应用配置
```bash
kubectl apply -f nginx-deployment.yaml
```
### 13.5.3 步骤 2创建 Service
创建一个名为 `nginx-service.yaml` 的文件
@@ -60,19 +58,16 @@ spec:
targetPort: 80
type: NodePort # 使用 NodePort 方便本地测试
```
应用配置
```bash
kubectl apply -f nginx-service.yaml
```
查看分配的端口
```bash
kubectl get svc nginx-service
```
如果输出端口是 `80:30080/TCP`你可以通过 `http://<NodeIP>:30080` 访问 Nginx
### 13.5.4 步骤 3模拟滚动更新
@@ -82,13 +77,11 @@ kubectl get svc nginx-service
```bash
kubectl apply -f nginx-deployment.yaml
```
观察更新过程
```bash
kubectl rollout status deployment/nginx-deployment
```
### 13.5.5 步骤 4清理资源
练习结束后记得清理资源