标签:work stat code 原因 pps kubectl ges src blog

pod是容器化的基础,好比大楼的地基。
跟容器的linux namespace相关的东西一定是Pod级别的,pod。
比如:
网络:  hostAliases : 写入/ect/hosts内容 ;  sharePrcessNamespace: 共享PID 空间
存储: vlume
安全:   secret
调度: NodeSelector  用户指定pod跟node的对应关系 ; NodeName 标识调度过了,可用来调试pod;
| 元素 | 说明 | 
|---|---|
| image | 镜像地址 | 
| ports | 端口定义 | 
| command | 启动指令 | 
| workingDir | 工作目录 | 
| volumeMounts | 数据卷挂载 | 
| imagePullPolicy | 镜像拉取策略 | 
| lifecycle | 容器生命周期钩子定义 preStop postStart | 
通过 spec.status.phase来定位;
pending:创建过程中,由于某些原因调度失败
running:   正常运行中
succeed:  一次性调度成功
failed:  调度失败
unknow: 未知
还可以结合 condition来定位:
unscheduled: 没有调度
podScheduled: pod调度中
ready: 准备好
initalized: 初始化中
attach: 进入容器的tty 命令行,如果有安装的话;
kubectl attach -it youpodname -c youcontainername
围绕pod的核心字段做了介绍。
示例配置文件:
apiVersion: apps/v1
kind: Pod
metadata:
  name: my-pod
spec:
  shareProcessNamespace: true
  nodeSelector:
    diskType: ssd
  hostAliases:
  - ip: "10.10.10.9"
    hostnames:
    - "a.b.com"
    - "ac.b.com"
  lifecycle:
    postStart:
      exec:
        command: ["/bin/bash","-c","echo ‘xxxx‘> /usr/share/messages"]
    preStop:
      exec:
        command: ["/usr/sbin/nginx","-t","quit"]
原创不易,关注诚可贵,转发价更高!转载请注明出处,让我们互通有无,共同进步,欢迎沟通交流。
标签:work stat code 原因 pps kubectl ges src blog
原文地址:https://www.cnblogs.com/snidget/p/14407873.html