Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# NS
kubectl create ns cadvisor-issue-test
# PV
echo "
apiVersion: v1
kind: PersistentVolume
metadata:
name: pvc-cadvisor-issue-test
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 100Gi
mountOptions:
- hard
nfs:
path: /nfsexport/blub123
server: nfs.example.com
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs-netapp
volumeMode: Filesystem
" | kubectl apply -f-
# PVC
echo "
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cadvisor-issue-test
namespace: cadvisor-issue-test
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 100Gi
storageClassName: nfs-netapp
volumeMode: Filesystem
volumeName: pvc-cadvisor-issue-test
" | kubectl apply -f-
# CM
echo '
apiVersion: v1
kind: ConfigMap
metadata:
name: script
namespace: cadvisor-issue-test
data:
entrypoint.sh: |-
#!/bin/bash
set -x
for i in {1..60}
do
WAIT_SECONDS=$(shuf -i 0-60 -n 1)
sleep $WAIT_SECONDS
FILENAME=$(shuf -i 0-10000 -n 1)
echo "test123" > /opt/$FILENAME.txt
sleep 1
cat /opt/$FILENAME.txt
rm /opt/$FILENAME.txt
done
' | kubectl apply -f-
# Create pods
for i in {1..250}
do
echo "
apiVersion: v1
kind: Pod
metadata:
name: tshoot-pod-$i
namespace: cadvisor-issue-test
labels:
app: tshoot
spec:
restartPolicy: Never
volumes:
- name: cadvisor-issue-test
persistentVolumeClaim:
claimName: cadvisor-issue-test
- name: script
configMap:
defaultMode: 0700
name: script
containers:
- name: tshoot
image: ghcr.io/philipschmid/tshoot:0.0.4
command:
- /bin/entrypoint.sh
volumeMounts:
- mountPath: /opt
name: cadvisor-issue-test
- name: script
mountPath: /bin/entrypoint.sh
readOnly: true
subPath: entrypoint.sh
" | kubectl apply -f-
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment