Kubernetes Clean Up Finished Jobs Automatically

博客提及了已完成作业的TTL机制,这在信息技术领域可能涉及到资源管理、任务调度等方面,TTL机制可用于控制已完成作业的生命周期。

TTL Mechanism for Finished Jobs

apiVersion: batch/v1
kind: Job
metadata:
  name: pi-with-ttl
spec:
  ttlSecondsAfterFinished: 100
  template:
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
### Kubernetes Static Pod Documentation and Usage Static Pods are managed directly by the kubelet daemon on a specific node, without the need for the API server to manage them. These pods are always tied to the node where they reside and cannot be controlled via standard Kubernetes controllers like Deployments or ReplicaSets. To define a static pod, one must place its manifest file into a directory watched by the `kubelet`. By default, this is `/etc/kubernetes/manifests` on most systems[^4]. When the `kubelet` detects changes in any of these files (addition, modification, deletion), it will adjust the set of running containers accordingly. For example, consider creating a simple nginx static pod: ```yaml apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - name: nginx image: nginx ``` Save this configuration as `/etc/kubernetes/manifests/nginx.yaml`, after which the `kubelet` service should automatically start an instance of the specified container on that particular machine. Unlike regular pods created through the API server, there's no direct way to interact with static pods using `kubectl apply` commands because they do not exist within etcd database nor have corresponding objects inside the cluster state maintained by apiserver. However, once started, users can still inspect logs, describe status, delete manually from filesystem level but all operations related specifically to managing lifecycle such as scaling up/down replicas aren't applicable here since those features rely heavily upon higher-level abstractions provided by other components outside just the local node itself.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值