Pod总结

常用资源

Kubernetes API

  • Workload Resources
    • Pod
    • PodTemplate
    • ReplicationController
    • ReplicaSet
    • Deployment
    • StatefulSet
    • ControllerRevision
    • DaemonSet
    • Job
    • CronJob
    • HorizontalPodAutoscaler
    • HorizontalPodAutoscaler v2beta2
    • PriorityClass
  • Service Resources
    • Service
    • Endpoints
    • EndpointSlice
    • Ingress
    • IngressClass
  • Config and Storage Resources
    • ConfigMap
    • Secret
    • Volume
    • PersistentVolumeClaim
    • PersistentVolume
    • StorageClass
    • VolumeAttachment
    • CSIDriver
    • CSINode
    • CSIStorageCapacity
  • Authentication Resources
    • ServiceAccount
    • TokenRequest
    • TokenReview
    • CertificateSigningRequest
  • Authorization Resources
    • LocalSubjectAccessReview
    • SelfSubjectAccessReview
    • SelfSubjectRulesReview
    • SubjectAccessReview
    • ClusterRole
    • ClusterRoleBinding
    • Role
    • RoleBinding
  • Policy Resources
    • LimitRange
    • ResourceQuota
    • NetworkPolicy
    • PodDisruptionBudget
  • Extend Resources
    • CustomResourceDefinition
    • MutatingWebhookConfiguration
    • ValidatingWebhookConfiguration
  • Cluster Resources
    • Node
    • Namespace
    • Event
    • APIService
    • Lease
    • RuntimeClass
    • FlowSchema v1beta2
    • PriorityLevelConfiguration v1beta2
    • Binding
    • ComponentStatus
    • ClusterCIDR v1alpha1
  • Common Definitions
    • DeleteOptions
    • LabelSelector
    • ListMeta
    • LocalObjectReference
    • NodeSelectorRequirement
    • ObjectFieldSelector
    • ObjectMeta
    • ObjectReference
    • Patch
    • Quantity
    • ResourceFieldSelector
    • Status
    • TypedLocalObjectReference

describe

kubectl describe pod xxx结果:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Name:               my-demo-847d76cf5f-wwntx
Namespace:          my-tenant-123
Priority:           0
PriorityClassName:  <none>
Node:               10.202.81.62/10.202.81.62
Start Time:         Thu, 15 Sep 2022 17:41:22 +0800
Labels:             name=my-demo
                    paasos-app-instance-id=62f1fa3cfa24da00016a3065
                    paasos-platform-id=prod
                    paasos-project-id=61276dd4353e58000cdf39ae
                    paasos-tenant-id=61276c97c13c6d0001a41486
                    pod-template-hash=847d76cf5f
Annotations:        kubernetes.io/limit-ranger: LimitRanger plugin set: memory limit for container test-demo
Status:             Running
IP:                 172.16.6.132
Controlled By:      ReplicaSet/my-demo-847d76cf5f
Containers:
  test-demo:
    Container ID:   docker://fdf34de2f97c8af1f34a91ea8cbe40c553fc0d09a5619dc02eb73b23a3594431
    Image:          /test-demo:v1
    Image ID:       docker-pullable://test-demo@sha256:4bd84da12493d519e37be06ea4c24f0f1d824b4c56f14d0506814ab7e9a35148
    Ports:          8011/TCP, 4040/TCP, 7078/TCP, 7079/TCP, 9011/TCP
    Host Ports:     0/TCP, 0/TCP, 0/TCP, 0/TCP, 0/TCP
    State:          Running
      Started:      Thu, 15 Sep 2022 17:41:22 +0800
    Ready:          True
    Restart Count:  0
    Limits:
      memory:  15Gi
    Requests:
      memory:  200Mi
    Liveness:  http-get http://:8011/test-demo/health delay=30s timeout=5s period=10s #success=1 #failure=3
    Environment:
      JAVA_OPTS:             -Xss10m
      spark_master:          k8s://https://kubernetes.default:443
      min_executors:         1
      max_executors:         1
      executor_cores:        2
      executor_memory:       4g
      shuffle_partitions:    32
      kubernetes_namespace:  my-tenant-123
      lakehouse_root_path:   hdfs://nameservice1/user/hive/warehouse/lakehouse-alpha1
      kerberos_principal:    hive/[email protected]
      HADOOP_CONF_DIR:       /test-demo/resources/hadoop-config
      sys_rc_name:           my-demo
      serviceAccountName:    test-demo
      spark_hive_enable:     false
      enable_sql_api:        true
      app_id:                ekybiap
      cluster_name:          c1j8sal
      namespace:             55rdddn
      config_server:         http://10.202.40.81:30002
    Mounts:
      /test-demo/resources/config/application.properties from 55rdddne6c616db (rw,path="application.properties")
      /test-demo/resources/executor-pod-template.yml from 55rdddncbb2bcd7 (rw,path="executor-pod-template.yml")
      /test-demo/resources/kerberos/krb5.conf from 55rdddn936256fe (rw,path="krb5.conf")
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  55rdddncbb2bcd7:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      55rdddncbb2bcd7
    Optional:  false
  55rdddn936256fe:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      55rdddn936256fe
    Optional:  false
  55rdddne6c616db:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      55rdddne6c616db
    Optional:  false
  default-token-lmgbv:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-lmgbv
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  zone=public
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>

Pod定义

Pod定义文件模板中各属性的详细说明



K8S 的一些 API

fabric8 POD api

  • status
  • meta
    • label,namespace,annotation
  • spec
    • Priority,Affinity,DNS,Tolerations
    • HostAliases,Volumes,PodSecurity
    • PodReadinessGate,ServiceAccount
    • Container
      • command
      • env,EnvFromSource
      • volumn
      • resource-quota,Lifecycle
      • image,image 拉取策略,container name
    • init container
      • 跟 container 参数类似

Volumes

  • EmptyDir
  • NFS
  • csi
  • ceph,aws,gcp 等等 持久卷

几个 quota

  • priority class
  • resouce quota
  • pod,关联namespace,优先级

operator 特点

  • 可以做有状态管理
  • 自动监控状态,括、缩容,状态恢复
  • 根据根据定义,实现对状态的管理

Fabric8 API

  • 也可以编程的方式实现 operator 类似的功能
  • 完整控制了 pod 的全方面和生命周期
  • 可以 CURD pod,生命周期管理,状态监控,日志管理
  • 有这套 API,可以做非常多的事情

参考