Kubernetes----生産資源リスト定義Pod.yaml

16134 ワード

pod.yaml(kubectl explain pod)
KIND:     Pod
VERSION:  v1

DESCRIPTION:
     Pod is a collection of containers that can run on a host. This resource is
     created by clients and scheduled onto hosts.

apiVersion: v1  #   
kind: Pod #    
metadata: > #   
  name: > #pod  
  namespace: > #pod      
  labels: [string]string> #    
    key1: value1
    key2: value2
  annotations: [string]string> #    , label               ,        “   ”。
    key1: value1
    key2: value2
spec: > #  ,pod        
  containers: <[]Object> -required- #pod      ,       
  - name: > -required- #    
    image: > -required- #       
    imagePullPolicy: > (Always, Never, IfNotPresent) #       ,Alawys       IfnotPresent          ,      ,Nerver         ,   lastest   Always,     IfNotPresent
    command: <[]string> #         ,    ,            ,    bash shell,  Dockerfile ENTRYPOINT,  command ,    command    (            command)
    args: <[]string> #           , command    ,  Dockerfile CMD
    workingDir: > #       
    ports: <[]Object> #         
    - name: > #     
      containerPort: > -required- #    pod IP        
      hostPort: > #           ,   Container  
      hostIP: > #  host  IP        (       )
      protocol: > #    ,  TCP UDP,  TCP
    volumeMounts: <[]Object> #             
    - name: #  pod           ,  volumes[]        
      mountPath: > -required- #       mount       
    env: <[]Object>
      name: > -required-
      value: >
      valueFrom: >
    livenessProbe: > #        
      exec: > #          
        command: <[]string>
      httpGet: > #      http  
        host: > #Pod IP  
        httpHeaders: > 
        path: > #     url    
        port: > -required- #    
      tcpSocket: > #    TCP     。     TCP  
        host: > #Pod IP  
        port: > -required- #    
      initialDelaySeconds: > #             ,         (         )
      failureThreshold: > #              ,          ,  3,  1
      successThreshold: >
      periodSeconds: > #       (  s),  10s,  1s
      timeoutSeconds: > #       ,  1s
    readinessProbe: > #      ,    livenessProbe  
    lifecycle: >
      postStart: > #           
        exec: >
        httpGet: >
        tcpSocket: >
      preStop: > #           
  volumes: <[]Object>
    emptyDir: {}
    hostPath: >
      path: > -required-
      type: > #DirectoryOrCreate:           ;Directory:         ;FileOrCreate:           ;File:         ;Socket:;CharDevice:BlockDevice:;    
    nfs: >
      path: > -required-
      readOnly: > #  false
      server: > -required- #NFS server  
    persistentVolumeClaim: >
      claimName: > -required-
      readOnly: >
  nodeName: > #               
  nodeSelector: |string|string> #     ,           (  :key: value)
  restartPolicy: > #pod       ,Always:    、OnFailure:         、Never:     ,      
  hostNetwork: > #             
  hostPID: >
  hostIPC: >
  serviceAccountName: > #     serviceaccount  
status: >

argsとcommandの比較
Image Entrypoint
Image Cmd
Container command
Container args
Command run
[/ep-1]
[foo bar]
[ep-1 foo bar]
[/ep-1]
[foo bar]
[/ep-2]
[ep-2]
[/ep-1]
[foo bar]
[zoo boo]
[ep-1 zoo boo]
[/ep-1]
[foo bar]
[/ep-2]
[zoo boo]
[ep-2 zoo boo]