Kubernetes allows you to declare entry point command to be executed when container will be created first. This is very similar to Dockerfile CMD option where we can write a command that will start our service, server or application whenever new container will be created using the image built with this docker file.
apiVersion: v1
kind: Pod
metadata:
name: my-apache-php
labels:
app: my-apache-php
spec:
containers:
- name: my-apache
image: phpstorm/php-73-apache-xdebug-27
ports:
- containerPort: 80
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo '<?php phpinfo(); ?>' > index.php"]