简体   繁体   English

有没有办法查看谁在 Kubernetes 中运行 pods/jobs?

[英]Is there a way to see who ran pods/jobs in Kubernetes?

When I do kubectl top pods I only see NAME, CPU and MEMORY.当我执行kubectl top pods我只看到 NAME、CPU 和 MEMORY。

NAME                                                 CPU(cores)   MEMORY(bytes)   
bbox-inference-falcon-79dc678d8c-2fq9b               4m           1272Mi          
bbox-inference-falcon-79dc678d8c-2nfnk               3m           1503Mi          
bbox-inference-falcon-79dc678d8c-4579l               27m          1303Mi          
bbox-inference-falcon-79dc678d8c-4kjsz               3m           1032Mi          
bbox-inference-falcon-79dc678d8c-4mvxd               3m           1258Mi          
bbox-inference-falcon-79dc678d8c-4pw2t               3m           1115Mi 

I'd like to know who ran these jobs but kubectl describe pod pod_name doesn't give me the information.我想知道谁运行了这些作业,但是kubectl describe pod pod_name没有给我信息。

Is there any way to do it?有什么办法吗?

You can use Kubernetes Auditing: https://kubernetes.io/docs/tasks/debug-application-cluster/audit/您可以使用 Kubernetes 审计: https ://kubernetes.io/docs/tasks/debug-application-cluster/audit/

Set the Level to Metadata将级别设置为元数据

apiVersion: audit.k8s.io/v1beta1
kind: Policy
rules:
 — level: Metadata

Metadata will log: user, resource_name and timestamp元数据将记录:用户、资源名称和时间戳

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM