apiVersion: v1
kind: Pod
metadata:
name: pv-pod
namespace: auth
spec:
containers:
- name: busybox
image: busybox
#************** HERE is the command!
command: ['sh', '-c', 'while true; do echo date > /output/output.log; sleep 5; done']
volumeMounts:
- name: pv-storage
mountPath: /output
volumes:
- name: pv-storage
persistentVolumeClaim:
claimName: host-storage-pvc
This command is where i need to insert into a file "success! Wed Jun 8 20:28:01 WAST 2022",i.e. current timestamp.
command: ['sh', '-c', 'while true; do echo success! $date >> /output/output.log; sleep 5; done']
But it keeps writing 'success date'
CodePudding user response:
You could use command substitution for this. That would be in shell or bash, the same.
Additionally, you may need to escape the dollar sign, since $()
has a special meaning in Kubernetes manifests.
echo "success $$(date)" >> ...