I apologize. I forgot to show you copy.sh! Had I shown it to you, I might have caught my error. Turns out that I had left "tail -f /dev/null" at the end of the script, blocking the post-start hook. Moving the tail to the container command, the post-start hook script correctly copies the files, exits, and the endless tail in the container blocks the termination of the pod, which is what I want:
# copy.sh
cp /config/* /etc/opes/platinum/fix/brvm/
ls /etc/opes/platinum/fix/brvm/
#tail -f /dev/null
---
FROM busybox
# Add BRVM configuration files.
ADD brvm/* /config/
# Add script to copy configuration files into shared volume.
ADD copy.sh /
VOLUME /etc/opes/platinum/fix/brvm
# Run script.
CMD ["/bin/tail", "-f", "/dev/null"]
---
apiVersion: v1
kind: Pod
metadata:
name: platinum-fix
spec:
containers:
- name: fix-brvm
image: javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT
imagePullPolicy: Always
volumeMounts:
- name: fix-brvm-config
mountPath: /etc/opes/platinum/fix/brvm
lifecycle:
postStart:
exec:
command: [ "/bin/sh", "/copy.sh" ]
volumes:
- name: fix-brvm-config
emptyDir: {}
---
derek@derek-HP-EliteOne-800-G1-AiO:~/Projects/platinum/platinum-fix-group/platinum-fix/src/main/kubernetes$ kubectl describe pod platinum-fix
Name: platinum-fix
Namespace: default
Node: 172.17.4.201/172.17.4.201
Start Time: Wed, 14 Sep 2016 19:30:49 -0400
Labels: <none>
Status: Running
IP: 10.2.89.22
Controllers: <none>
Containers:
fix-brvm:
Container ID: docker://61df8621e2afbf324155ba46cdd1380ede7095f34be202401beb87bcb1f12a03
Image: javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT
Image ID: docker://sha256:1816c46ecd422a7b7be62b1519e28bec963a9b93b71194fcf8d5b39d29a655b9
Port:
State: Running
Started: Wed, 14 Sep 2016 19:30:49 -0400
Ready: True
Restart Count: 0
Environment Variables: <none>
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
Volumes:
fix-brvm-config:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
default-token-1lggo:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-1lggo
QoS Tier: BestEffort
Events:
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
7m 7m 1 {default-scheduler } Normal Scheduled Successfully assigned platinum-fix to 172.17.4.201
7m 7m 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} Normal Pulling pulling image "javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT"
7m 7m 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} Normal Pulled Successfully pulled image "javaqa:5000/opessoftware/platinum-fix-brvm:1.1.0-SNAPSHOT"
7m 7m 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} Normal Created Created container with docker id 61df8621e2af
7m 7m 1 {kubelet 172.17.4.201} spec.containers{fix-brvm} Normal Started Started container with docker id 61df8621e2af
---
derek@derek-HP-EliteOne-800-G1-AiO:~/Projects/platinum/platinum-fix-group/platinum-fix/src/main/kubernetes$ kubectl exec platinum-fix -c fix-brvm -- ls /etc/opes/platinum/fix/brvm/
brvm-fix44.xml
keystore.jks
settings.txt
Thank you for helping me find the bug!