Kubernetes for FDE(FDE 的 Kubernetes 技能)
知识库位置:
FDE Knowledge Base/03 Engineering/Cloud & DevOps/Kubernetes/Kubernetes-for-FDE.md术语不确定时,请查阅 Glossary(中英文术语表)。
1. What It Is(它是什么)
Section titled “1. What It Is(它是什么)”Kubernetes(容器编排平台)是用于运行和管理容器化应用的平台。
核心模型:
Container(容器)↓Pod(容器组)↓Deployment(部署)↓Service(服务)Kubernetes 负责:
- scheduling(调度)
- restart(重启)
- scaling(扩缩容)
- service discovery(服务发现)
- rollout(滚动发布)
2. Why FDE Cares(FDE 为什么关心)
Section titled “2. Why FDE Cares(FDE 为什么关心)”很多企业客户已经有 Kubernetes 平台。
FDE 可能需要:
- deploy customer solution(部署客户方案)
- debug production(调试生产问题)
- inspect service(检查服务)
- work inside private cluster(在私有集群内工作)
- integrate with existing infrastructure(与既有基础设施集成)
因此 FDE 应该:
能使用 Kubernetes,而不必成为 Platform Engineer(平台工程师)。
3. Core Concepts(核心概念)
Section titled “3. Core Concepts(核心概念)”Cluster(集群)
Section titled “Cluster(集群)”整个 Kubernetes 环境。
Node(节点)
Section titled “Node(节点)”运行 workload(工作负载)的机器。
Pod(容器组)
Section titled “Pod(容器组)”最小运行单元。
通常包含一个或多个 Container(容器)。
Deployment(部署)
Section titled “Deployment(部署)”描述:
- desired replicas(期望副本数)
- container image(容器镜像)
- rollout(滚动发布)
Service(服务)
Section titled “Service(服务)”为 Pod 提供稳定网络入口。
Ingress(入口路由)
Section titled “Ingress(入口路由)”用于外部 HTTP/HTTPS 路由。
Namespace(命名空间)
Section titled “Namespace(命名空间)”逻辑隔离。
常用于:
- environment(环境)
- team(团队)
- tenant(租户)
ConfigMap(配置对象)
Section titled “ConfigMap(配置对象)”非敏感配置。
Secret(密钥对象)
Section titled “Secret(密钥对象)”敏感配置。
但 Secret 本身并不等于完整 Secrets Management(密钥管理)方案。
4. Basic Request Flow(基础请求链路)
Section titled “4. Basic Request Flow(基础请求链路)”User(用户)↓Ingress / Load Balancer(入口路由/负载均衡器)↓Service(服务)↓Pod(容器组)↓Application(应用)Debug(调试)时需要逐层定位。
5. FDE Minimum Operational Skills(FDE 最低操作技能)
Section titled “5. FDE Minimum Operational Skills(FDE 最低操作技能)”FDE 应能:
- inspect pods(检查容器组)
- view logs(查看日志)
- describe workload(描述工作负载)
- check service(检查服务)
- inspect config(检查配置)
- understand rollout(理解滚动发布)
- restart / rollback under proper control(在受控下重启/回滚)
- inspect health probes(检查健康探针)
6. Health Checks(健康检查)
Section titled “6. Health Checks(健康检查)”常见:
Liveness(存活探针)
Section titled “Liveness(存活探针)”应用是否“活着”。
Readiness(就绪探针)
Section titled “Readiness(就绪探针)”应用是否准备接流量。
如果 Readiness 设计错误:
Pod 虽然运行,但可能接收还未准备好的请求。
7. Requests and Limits(资源请求与上限)
Section titled “7. Requests and Limits(资源请求与上限)”Container(容器)可以定义:
CPU Request(CPU 请求)Memory Request(内存请求)CPU Limit(CPU 上限)Memory Limit(内存上限)如果配置错误:
- scheduling failure(调度失败)
- throttling(节流)
- OOMKilled(内存不足被终止)
8. Scaling(扩缩容)
Section titled “8. Scaling(扩缩容)”Kubernetes 可运行多个 Pod:
1→N replicas(N 个副本)但:
增加 Pod 不一定解决所有性能问题。
如果瓶颈在:
- database(数据库)
- external API(外部接口)
- LLM(大语言模型)
- shared state(共享状态)
横向扩容可能无效。
9. Configuration(配置管理)
Section titled “9. Configuration(配置管理)”环境差异应通过:
- Config(配置)
- Secret(密钥)
- Environment(环境变量)
管理。
不要:
Hardcode production URL(硬编码生产地址)进代码。
10. Networking(网络)
Section titled “10. Networking(网络)”常见故障:
DNS(域名解析)Service name(服务名)Port(端口)Ingress(入口路由)Firewall(防火墙)Network Policy(网络策略)TLS(传输层安全)FDE 不应看到:
Connection refused(连接被拒绝)
就直接假设 Application bug(应用缺陷)。
11. Rollout(滚动发布)
Section titled “11. Rollout(滚动发布)”Deployment 更新后通常会滚动替换 Pod。
生产前应考虑:
- readiness(就绪检查)
- backward compatibility(向后兼容)
- DB migration(数据库迁移)
- rollback(回滚)
12. Common Failure Modes(常见失败状态)
Section titled “12. Common Failure Modes(常见失败状态)”CrashLoopBackOff(崩溃循环)
Section titled “CrashLoopBackOff(崩溃循环)”应用不断启动失败。
查:
- logs(日志)
- config(配置)
- secret(密钥)
- dependency(依赖)
ImagePullBackOff(镜像拉取失败)
Section titled “ImagePullBackOff(镜像拉取失败)”镜像无法下载。
OOMKilled(内存不足被终止)
Section titled “OOMKilled(内存不足被终止)”内存不足。
Pending(待调度)
Section titled “Pending(待调度)”可能:
- resource insufficient(资源不足)
- scheduling constraint(调度约束不满足)
Ready = False(未就绪)
Section titled “Ready = False(未就绪)”应用未通过 Readiness(就绪检查)。
13. Kubernetes and FDE Scope(Kubernetes 与 FDE 的边界)
Section titled “13. Kubernetes and FDE Scope(Kubernetes 与 FDE 的边界)”FDE 通常应解决:
Application deployment(应用部署)Basic debugging(基础调试)Configuration(配置)Service connectivity(服务连通性)如果涉及:
Cluster architecture(集群架构)CNI internals(CNI,Container Network Interface,容器网络接口的内部机制)Multi-region platform(多区域平台)Deep autoscaling platform engineering(深度自动扩缩平台工程)应该拉 Platform Specialist(平台专家)。
14. Security(安全)
Section titled “14. Security(安全)”关注:
- RBAC(Role-Based Access Control,基于角色的访问控制)
- Namespace(命名空间)
- Service Account(服务账号)
- Secret(密钥对象)
- Network Policy(网络策略)
- Image security(镜像安全)
应用权限不应自动获得:
Cluster-wide admin(集群级管理员权限)。
15. FDE Depth(FDE 深度要求)
Section titled “15. FDE Depth(FDE 深度要求)”目标:
Level B — Operate(B 级:操作)部分 Senior FDE(高级 FDE)可达到:
Level C — Design(C 级:设计)但不默认要求 Level D Platform Specialist(D 级:平台专家)。