-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s.yaml
51 lines (50 loc) · 1.19 KB
/
k8s.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-reader-account
namespace: test-postgres-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: test-postgres-operator
name: pod-reader
rules:
- apiGroups: [ "" ]
resources: [ "pods" ]
verbs: [ "get", "watch", "list" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: read-pods
namespace: test-postgres-operator
subjects:
- kind: ServiceAccount
name: pod-reader-account
namespace: test-postgres-operator
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: retrieve-all-pods-job
spec:
template:
spec:
serviceAccountName: pod-reader-account
containers:
- name: curl
image: curlimages/curl
command:
- "/bin/sh"
- "-c"
args:
- >
curl -k https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT/api/v1/namespaces/test-postgres-operator/pods
-H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
restartPolicy: Never
backoffLimit: 1