• pod json关键字解析


    {'api_version': 'v1',
     'items': [
     
                {'api_version': None,
                'kind': None,
                'metadata': {'annotations': None,
                             'cluster_name': None,
                             'creation_timestamp': datetime.datetime(2020, 9, 10, 5, 9, tzinfo=tzutc()),
                             'deletion_grace_period_seconds': None,
                             'deletion_timestamp': None,
                             'finalizers': None,
                             'generate_name': 'test-devops-itmp-ks-yunweibaobiaopingtai-54fd4b46b6-',
                                # pod 名字公共部分信息
                             'generation': None,
                             'initializers': None,
                             'labels': {'app': 'test-devops-itmp-ks-yunweibaobiaopingtai',
                                        'pod-template-hash': '54fd4b46b6'}, 
                             'managed_fields': None,
                             'name': 'test-devops-itmp-ks-yunweibaobiaopingtai-54fd4b46b6-jf4ll',  #pod 名字
                             'namespace': 'test', #名称空间
                             'owner_references': [{'api_version': 'apps/v1',
                                                   'block_owner_deletion': True,
                                                   'controller': True,
                                                   'kind': 'ReplicaSet',
                                                   'name': 'test-devops-itmp-ks-yunweibaobiaopingtai-54fd4b46b6',  #所属副本集
                                                   'uid': '8984285f-a2cf-4032-a54b-134bdd01ad62'}],
                             'resource_version': '28829876',
                             'self_link': '/api/v1/namespaces/test/pods/test-devops-itmp-ks-yunweibaobiaopingtai-54fd4b46b6-jf4ll',
                             'uid': 'cb208f6f-6cae-4bf0-ab50-d13b239e944e'},
                'spec': {'active_deadline_seconds': None,
                         'affinity': None,
                         'automount_service_account_token': None,
                         'containers': [{'args': None,
                                         'command': None,
                                         'env': None,
                                         'env_from': None,
                                         'image': '10.10.87.56:445/devops_itmp_k8s/devops_itmp_k8s:V1.8469.1',
                                         'image_pull_policy': 'IfNotPresent',
                                         'lifecycle': None,
                                         # 存活探针
                                         'liveness_probe': {'_exec': None,
                                                            'failure_threshold': 10, # Pod成功启动且检查失败时,Kubernetes将在放弃之前尝试failureThreshold次。放弃生存检查意味着重新启动Pod。而放弃就绪检查,Pod将被标记为未就绪。默认为3.最小值为1。
                                                            # http_get HTTP探针
                                                            'http_get': {'host': None,    # host主机名,默认为pod的IP
                                                                         'http_headers': None,    # http_headers在HTTP请求中设置的自定义标头。 HTTP允许重复的请求头。
                                                                         'path': '/',      # path探针的路径。
                                                                         'port': 8021,     # port端口的名称或编号。数字必须在1到65535的范围内。
                                                                         'scheme': 'HTTP'},  # scheme用于连接主机的方案(HTTP或HTTPS)。默认为HTTP。
                                                            'initial_delay_seconds': 30,  # initial_delay_seconds容器启动和探针启动之间的秒数。
                                                            'period_seconds': 30,         # period_seconds检查的频率(以秒为单位)。默认为10秒。最小值为1。
                                                            'success_threshold': 1,       # success_threshold失败后检查成功的最小连续成功次数。默认为1.活跃度必须为1。最小值为1。
                                                            'tcp_socket': None,
                                                            'timeout_seconds': 1},        # timeout_seconds检查超时的秒数。默认为1秒。最小值为1
                                         'name': 'main',
                                         'ports': None,
                                         # 就绪探针
                                         'readiness_probe': {'_exec': None,
                                                             'failure_threshold': 10,
                                                             'http_get': {'host': None,
                                                                          'http_headers': None,
                                                                          'path': 'http://127.0.0.1:8021',
                                                                          'port': 8021,
                                                                          'scheme': 'HTTP'},
                                                             'initial_delay_seconds': 30,
                                                             'period_seconds': 30,
                                                             'success_threshold': 1,
                                                             'tcp_socket': None,
                                                             'timeout_seconds': 1},
                                          # 资源限制  结合下面 qos_class
                                         'resources': {'limits': {'cpu': '0',
                                                                  'memory': '107374182400m'},
                                                       'requests': {'cpu': '0',
                                                                    'memory': '107374182400m'}},
                                         # 资源对象之一
                                         'security_context': None,
                                         'stdin': None,
                                         'stdin_once': None,
                                          # 日志存放目录,映射到节点的/var/lib/docker/logs 数据盘,应用日志目录设置到/home/{user_name}/logs 下
                                         'termination_message_path': '/dev/termination-log',
                                         'termination_message_policy': 'File',
                                         'tty': None,
                                         'volume_devices': None,
                                         'volume_mounts': [{'mount_path': '/opt/ITMP/settings.py',
                                                            'mount_propagation': None,
                                                            'name': 'volum300',
                                                            'read_only': None,
                                                            'sub_path': 'settings.py',
                                                            'sub_path_expr': None},
                                                           {'mount_path': '/var/run/secrets/kubernetes.io/serviceaccount',
                                                            'mount_propagation': None,
                                                            'name': 'default-token-2jd5v',
                                                            'read_only': True,
                                                            'sub_path': None,
                                                            'sub_path_expr': None}],
                                         'working_dir': None}],
                         'dns_config': None,
                         'dns_policy': 'ClusterFirst',
                         'enable_service_links': True,
                         'host_aliases': None,
                         'host_ipc': None,
                         'host_network': None,
                         'host_pid': None,
                         'hostname': None,
                         'image_pull_secrets': None,
                         'init_containers': None,
                         'node_name': '10.10.87.71',
                         'node_selector': None,
                         'preemption_policy': None,
                         'priority': None,
                         'priority_class_name': None,
                         'readiness_gates': None,
                         'restart_policy': 'Always',
                         'runtime_class_name': None,
                         'scheduler_name': 'default-scheduler',
                         'security_context': {'fs_group': None,
                                              'run_as_group': None,
                                              'run_as_non_root': None,
                                              'run_as_user': None,
                                              'se_linux_options': None,
                                              'supplemental_groups': None,
                                              'sysctls': None,
                                              'windows_options': None},
                         'service_account': 'default',
                         'service_account_name': 'default',
                         'share_process_namespace': None,
                         'subdomain': None,
                         'termination_grace_period_seconds': 30,
                         'tolerations': None,
                         'volumes': [{'aws_elastic_block_store': None,
                                      'azure_disk': None,
                                      'azure_file': None,
                                      'cephfs': None,
                                      'cinder': None,
                                      'config_map': {'default_mode': 420,
                                                     'items': [{'key': 'setting',
                                                                'mode': None,
                                                                'path': 'settings.py'}],
                                                     'name': 'test-devops-itmp-ks-yunweibaobiaopingtai-configmap',
                                                     'optional': None},
                                      'csi': None,
                                      'downward_api': None,
                                      'empty_dir': None,
                                      'fc': None,
                                      'flex_volume': None,
                                      'flocker': None,
                                      'gce_persistent_disk': None,
                                      'git_repo': None,
                                      'glusterfs': None,
                                      'host_path': None,
                                      'iscsi': None,
                                      'name': 'volum300',
                                      'nfs': None,
                                      'persistent_volume_claim': None,
                                      'photon_persistent_disk': None,
                                      'portworx_volume': None,
                                      'projected': None,
                                      'quobyte': None,
                                      'rbd': None,
                                      'scale_io': None,
                                      'secret': None,
                                      'storageos': None,
                                      'vsphere_volume': None},
                                     {'aws_elastic_block_store': None,
                                      'azure_disk': None,
                                      'azure_file': None,
                                      'cephfs': None,
                                      'cinder': None,
                                      'config_map': None,
                                      'csi': None,
                                      'downward_api': None,
                                      'empty_dir': None,
                                      'fc': None,
                                      'flex_volume': None,
                                      'flocker': None,
                                      'gce_persistent_disk': None,
                                      'git_repo': None,
                                      'glusterfs': None,
                                      'host_path': None,
                                      'iscsi': None,
                                      'name': 'default-token-2jd5v',
                                      'nfs': None,
                                      'persistent_volume_claim': None,
                                      'photon_persistent_disk': None,
                                      'portworx_volume': None,
                                      'projected': None,
                                      'quobyte': None,
                                      'rbd': None,
                                      'scale_io': None,
                                      'secret': {'default_mode': 420,
                                                 'items': None,
                                                 'optional': None,
                                                 'secret_name': 'default-token-2jd5v'},
                                      'storageos': None,
                                      'vsphere_volume': None}]},
                'status': {'conditions': [{'last_probe_time': None,
                                           'last_transition_time': datetime.datetime(2020, 9, 10, 5, 9, tzinfo=tzutc()),
                                           'message': None,
                                           'reason': None,
                                           'status': 'True',
                                           'type': 'Initialized'},
                                          {'last_probe_time': None,
                                           'last_transition_time': datetime.datetime(2020, 9, 10, 5, 9, 59, tzinfo=tzutc()),
                                           'message': None,
                                           'reason': None,
                                           'status': 'True',
                                           'type': 'Ready'},
                                          {'last_probe_time': None,
                                           'last_transition_time': datetime.datetime(2020, 9, 10, 5, 9, 59, tzinfo=tzutc()),
                                           'message': None,
                                           'reason': None,
                                           'status': 'True',
                                           'type': 'ContainersReady'},
                                          {'last_probe_time': None,
                                           'last_transition_time': datetime.datetime(2020, 9, 10, 5, 9, tzinfo=tzutc()),
                                           'message': None,
                                           'reason': None,
                                           'status': 'True',
                                           'type': 'PodScheduled'}],
                            # 容器组中个容器的状态           
                           'container_statuses': [{'container_id': 'docker://b4c15bde156eb00548fd01e47779d46223717d37330a0f15deb6013e701a5ed5',
                                                   'image': '10.10.87.56:445/devops_itmp_k8s/devops_itmp_k8s:V1.8469.1',  #镜像地址
                                                   'image_id': 'docker-pullable://10.10.87.56:445/devops_itmp_k8s/devops_itmp_k8s@sha256:c2dfd6bac830fb507e77a14bebe8f7050b78bd1a6b62191f35e0e22f887a4592',
                                                   'last_state': {'running': None,
                                                                  'terminated': None,
                                                                  'waiting': None},
                                                   'name': 'main',
                                                   'ready': True,     
                                                        #pod中某个容器的状态
                                                   'restart_count': 0,   
                                                        #容器重启数
                                                   # 实时状态
                                                   'state': {'running': {'started_at': datetime.datetime(2020, 9, 10, 5, 9, 2, tzinfo=tzutc())},
                                                             'terminated': None,
                                                             'waiting': None}}],
                                
                           'host_ip': '10.10.87.71',   
                                # 节点ip
                           'init_container_statuses': None,
                           'message': None,
                           'nominated_node_name': None,
                                # 制定的节点名字
                           'phase': 'Running',
                                # pod状态
                                # Pending  系统已经接收了创建了pod的请求,但是其中有部分容器未创建。这包括容器调度、镜像下载等需要花费一段时间。
                                # Running   pod已经被绑定在某个node上了,所有的容器都已经被创建,至少有一个容器任然在运行、启动、重启状态。
                                # Succeeded  pod上的所有容器都已经被成功停止,并且不会再被重启。
                                # Failed    所有容器都终止运行,至少有一个容器停止失败(非正常状态推出或者被系统终止运行)
                                # Unknown  由于某些原因,pod的运行阶段无法获取,通常是因为与pod所在主机发生通信故障(无法连接)。
                           'pod_ip': '172.17.3.15',  
                                # podip
                           'qos_class': 'Burstable', 
                                # qos_class服务质量等级(也就划分的优先级) 
                                # Guranteed(required=limit 或者是有 limit  )>Burstable(其他类型都是burstale)>best-effort (没有limit和ruquest) ,
                                # cpu是可压缩的,超出了limilt pod不会被kill,但是cpu会减速;内存是不可压缩的,超出limit,pod很可能会被kill(触发oom killer时,遍历系统上所有进程打分的情况)
                                # Best-Effort pods 优先级最低。如果系统内存耗尽,该类型的pods中的进程最先被kill。这些容器可以使用系统上任意量的空闲内存。
                                # Guaranteed pods 优先级最高。它们能够确保不达到容器设置的limit上限一定不会被kill。只有在系统存在内存压力且没有更低优先级容器时才被驱逐。
                                # Burstable pods 有一些形式的最小资源保证,但当需要时可以使用更多资源。在系统存在内存瓶颈时,一旦内存超过他们的request值并且没有Best-Effort 类型的容器存在,这些容器就先被kill掉。
                           'reason': None,
                                # 异常原因 
                           'start_time': datetime.datetime(2020, 9, 10, 5, 9, tzinfo=tzutc())}},
                }
                           
                           ],
     
     
     'kind': 'PodList',
     'metadata': {'_continue': None,
                  'remaining_item_count': None,
                  'resource_version': '30518363',
                  'self_link': '/api/v1/namespaces/test/pods'}}
    
    Process finished with exit code 0
  • 相关阅读:
    匿名方法
    优化从 App.config 读取配置文件
    显示(explicit )与隐式(implicit)转换操作符
    ( 转 ) 聊一聊C#的Equals()和GetHashCode()方法
    协变和逆变
    html frameset的介绍
    html <frame>标签使用
    html <table>标签信息
    html 列表相关信息
    html <form>相关表单
  • 原文地址:https://www.cnblogs.com/Hale-wang/p/13725423.html
Copyright © 2020-2023  润新知