Created
October 14, 2023 04:10
-
-
Save mattmattox/33062e5434536cf3cc493feed651abd5 to your computer and use it in GitHub Desktop.
Revisions
-
mattmattox renamed this gist
Oct 14, 2023 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mattmattox created this gist
Oct 14, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ --- apiVersion: v1 kind: ServiceAccount metadata: name: log-watcher-sa namespace: cert-manager --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: log-watcher-cluster-role rules: - apiGroups: [""] resources: ["pods"] verbs: ["get", "list", "watch", "delete"] - apiGroups: [""] resources: ["pods/log"] verbs: ["get", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: log-watcher-cluster-role-binding subjects: - kind: ServiceAccount name: log-watcher-sa namespace: cert-manager roleRef: kind: ClusterRole name: log-watcher-cluster-role apiGroup: rbac.authorization.k8s.io --- apiVersion: apps/v1 kind: Deployment metadata: name: log-watcher labels: app: log-watcher spec: replicas: 1 selector: matchLabels: app: log-watcher template: metadata: labels: app: log-watcher spec: serviceAccountName: log-watcher-sa containers: - name: log-watcher image: supporttools/kube-builder command: ["/bin/sh", "-c"] args: - > while true; do pod_list=$(kubectl -n cert-manager get pods -l app.kubernetes.io/component=controller,app.kubernetes.io/instance=cert-manager -o name); for pod in $pod_list; do if kubectl -n cert-manager logs $pod | grep -q "streamwatcher.go:111] Unexpected EOF during watch stream event decoding: unexpected EOF"; then kubectl -n cert-manager delete $pod; fi; done; sleep 60; done; ---