-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Hi there, I am planning to use the image as the cronjob for my kubernetes pods which are marked as completed.
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: cleanup-prod
spec:
schedule: "*/20 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: kubectl-runner
image: werner/kubectl
command: ["sh", "-c", "kubectl delete pods -n test-prod $(kubectl get pods -n test-prod |grep 'Completed'| awk '$3 ' | awk '{print $1}')"]
restartPolicy: Never
when log from the pods/cronjob
kubectl logs cleanup-prod-156kd -n default
No resources found, use --show-all to see completed objects.
error: resource(s) were provided, but no name, label selector, or --all flag specified
Metadata
Metadata
Assignees
Labels
No labels