Skip to content

Instantly share code, notes, and snippets.

@PhilipSchmid
Created October 19, 2021 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilipSchmid/c19d085363809e5ba2356037e5e66551 to your computer and use it in GitHub Desktop.
Save PhilipSchmid/c19d085363809e5ba2356037e5e66551 to your computer and use it in GitHub Desktop.
# 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