apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: cli
name: cli
spec:
replicas: 1
selector:
matchLabels:
app: cli
strategy:
type: Recreate
template:
metadata:
labels:
app: cli
spec:
serviceAccount: viewer
serviceAccountName: viewer
containers:
- image: image-registry.openshift-image-registry.svc:5000/openshift/cli:latest
imagePullPolicy: Always
name: cli
# command: ["/usr/bin/sleep","infinity"]
command:
- /usr/bin/sh
- -c
- |
while true; do
date;
echo "====== OC ======"
oc adm top pod
echo "====== cURL ====="
curl -s --cacert /run/secrets/kubernetes.io/serviceaccount/ca.crt \
--header "Authorization: Bearer $(cat /run/secrets/kubernetes.io/serviceaccount/token)" \
https://kubernetes.default.svc.cluster.local/apis/metrics.k8s.io/v1beta1/namespaces/$KUBERNETES_NAMESPACE/pods ;
sleep 5;
done
# https://access.redhat.com/solutions/5175931
env:
- name: HOME
value: /tmp
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace