一、Pod对象管理命令
1. 创建Pod
- 两种创建方式:
- 通过YAML文件:kubectl apply -f pod.yaml
- 直接使用命令:kubectl run nginx --image=nginx
- 命令创建示例:
- 创建busybox测试容器:kubectl run busybox --image=nginx -- sleep 24h
- 带参数运行:kubectl run nginx --image=nginx -- <arg1> <arg2>
- 自定义命令:kubectl run nginx --image=nginx --command -- <cmd> <arg1>
2. 查看Pod
- 基础查看:
- 列表查看:kubectl get pods
- 详细信息:kubectl describe pod <Pod名称>
- 详细说明:
- 通过describe可查看Pod分配的节点、使用的镜像等完整信息
- 对于多容器Pod,describe会显示每个容器的独立状态
3. 查看日志
Kubernetes中Pod对象管理与健康策略
订阅专栏 解锁全文
1188

被折叠的 条评论
为什么被折叠?



