在Kubernetes容器下获取容器内容器的状态

时间:2019-07-13 10:43:39

标签: kubernetes google-kubernetes-engine kubernetes-helm azure-kubernetes kubernetes-pod

我正在使用可在Kubernetes集群上运行的NVIDIA Clara Deploy SDK。它提供了从E2E医学图像分析(获取到分析/细分)的管道。在使用此功能时,端到端流程不起作用。因为来自容器内容器之一的输出为空。虽然我可以获取主容器的日志,但是我不确定如何获取在特定容器中运行的容器的日志?

我通过在线研究执行了以下命令,下面列出了图片,

sudo kubectl get pods --all-namespaces -o jsonpath="{..image}" |tr -s '[[:space:]]' '\n' |sort |uniq -c

enter image description here

稍后,我执行此命令,它列出了该容器中的容器

sudo kubectl describe pod clara-clara-platform-7bb6f9f5c6-pdzgd

这会列出吊舱中的5个容器

1)推理服务器 2)Dicom服务器 3)渲染服务器 4)克拉拉核心 5)Clara-dashboard

但是clara在容器中有容器。这就是我的理解方式。不确定我是否正确。

共享以下文档供您参考。我想以上所有容器图像都是“ Clara-core”主容器的一部分。如何获取主容器中子容器的状态?

enter image description here

当我尝试获取上述容器的日志时,我没有看到有关执行ai容器(applastchannel)时发生了什么的任何信息?

请注意,在我的情况下,我想获取ai容器的状态为“ applastchannel”

这是YAML文件

apiVersion: v1
 items:
 - apiVersion: v1
 kind: Pod
 metadata:
  creationTimestamp: null
  generateName: clara-clara-platform-7bb6f9f5c6-
  labels:
   app.kubernetes.io/instance: clara
   app.kubernetes.io/name: clara-platform
  pod-template-hash: 7bb6f9f5c6
ownerReferences:
- apiVersion: apps/v1
  blockOwnerDeletion: true
  controller: true
  kind: ReplicaSet
  name: clara-clara-platform-7bb6f9f5c6
  uid: d0f0dc14-8b7e-45e3-8528-0879c7ce9330
selfLink: /api/v1/namespaces/default/pods/clara-clara-platform-7bb6f9f5c6- 
 pdzgd
  spec:
   containers:
   - args:
   - --model-store=/models
   command:
   - trtserver
   image: clara/trtis:0.1.8
   imagePullPolicy: IfNotPresent
   livenessProbe:
    failureThreshold: 3
    httpGet:
      path: /api/health/live
      port: 8000
      scheme: HTTP
     initialDelaySeconds: 5
     periodSeconds: 5
     successThreshold: 1
     timeoutSeconds: 1
   name: inference-server
   ports:
   - containerPort: 8000
     protocol: TCP
   - containerPort: 8001
     protocol: TCP
   - containerPort: 8002
     protocol: TCP
   readinessProbe:
     failureThreshold: 3
     httpGet:
       path: /api/health/ready
      port: 8000
      scheme: HTTP
     initialDelaySeconds: 5
     periodSeconds: 5
     successThreshold: 1
     timeoutSeconds: 1
   resources: {}
   securityContext:
     runAsUser: 1000
   terminationMessagePath: /dev/termination-log
   terminationMessagePolicy: File
  volumeMounts:
   - mountPath: /models
    name: pv-clara-volume
    subPath: models
   - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
    name: clara-service-account-token-c62fp
    readOnly: true
 - image: clara/dicomserver:0.1.8
   imagePullPolicy: Never
   name: dicom-server
   ports:
  - containerPort: 104
    hostPort: 104
    name: dicom-port
    protocol: TCP
  resources: {}
  terminationMessagePath: /dev/termination-log
  terminationMessagePolicy: File
  volumeMounts:
  - mountPath: /payloads
    name: pv-clara-volume
    subPath: clara-core/payloads
  - mountPath: /app/app.yaml
    name: dicom-server-config
    subPath: app.yaml
  - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
    name: clara-service-account-token-c62fp
    readOnly: true
- image: clara/core:0.1.8
  imagePullPolicy: Never
  name: clara-core
  ports:
  - containerPort: 50051
    protocol: TCP
  resources: {}
  terminationMessagePath: /dev/termination-log
  terminationMessagePolicy: File
  volumeMounts:
  - mountPath: /app/Jobs
    name: pv-clara-volume
    subPath: clara-core/payloads
  - mountPath: /app/Workflows
    name: pv-clara-volume
    subPath: clara-core/workflows
  - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
    name: clara-service-account-token-c62fp
    readOnly: true
- image: clara/clara-dashboard:0.1.8
  imagePullPolicy: Never
  name: clara-dashboard
  ports:
  - containerPort: 8080
    hostPort: 8080
    name: dashboard-port
    protocol: TCP
  resources: {}
  terminationMessagePath: /dev/termination-log
  terminationMessagePolicy: File
  volumeMounts:
  - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
    name: clara-service-account-token-c62fp
    readOnly: true
- image: clara/renderserver:0.1.8
  imagePullPolicy: Never
  name: render-server
  ports:
  - containerPort: 2050
    hostPort: 2050
    name: render-port
    protocol: TCP
  resources: {}
  terminationMessagePath: /dev/termination-log
  terminationMessagePolicy: File
  volumeMounts:
  - mountPath: /app/datasets
    name: pv-clara-volume
    subPath: datasets
  - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
    name: clara-service-account-token-c62fp
    readOnly: true
dnsPolicy: ClusterFirst
enableServiceLinks: true
imagePullSecrets:
- name: nvcr.io
nodeName: whiskey
priority: 0
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: clara-service-account
serviceAccountName: clara-service-account
terminationGracePeriodSeconds: 30
tolerations:
- effect: NoExecute
  key: node.kubernetes.io/not-ready
  operator: Exists
  tolerationSeconds: 300
- effect: NoExecute
  key: node.kubernetes.io/unreachable
  operator: Exists
  tolerationSeconds: 300
volumes:
- name: pv-clara-volume
  persistentVolumeClaim:
    claimName: pv-clara-volume-claim
- configMap:
    defaultMode: 420
    items:
    - key: app.Release.yaml
      path: app.yaml
    name: clara-configmap
  name: dicom-server-config
- name: clara-service-account-token-c62fp
  secret:
    defaultMode: 420
    secretName: clara-service-account-token-c62fp
  status:
 phase: Pending
 qosClass: BestEffort
 kind: List
 metadata:
 resourceVersion: ""
 selfLink: ""

您能帮我实现这一目标吗?

1 个答案:

答案 0 :(得分:1)

看着yaml,我只能在豆荚中看到这些容器:

Image:                          Name:
clara/core:0.1.8                clara-core
clara/clara-dashboard:0.1.8     clara-dashboard
clara/renderserver:0.1.8        render-server
clara/trtis:0.1.8               inference-server
clara/dicomserver:0.1.8         dicom-server

我不确定您需要哪一个,似乎没有什么叫AI,但是您可以通过以下两种方式检查日志:

kubectl logs clara-clara-platform-7bb6f9f5c6-pdzgd %container_name%

因此,如果inference-server是您感兴趣的人:

kubectl logs clara-clara-platform-7bb6f9f5c6-pdzgd inference-server