I'm using the following script to deploy new image to a kubernetes cluster:
#!/usr/bin/env bash
set -euo pipefail
set -x
rootPath=".."
gcpProjectId="example123"
gcpRepoHostname="eu.gcr.io"
imageName="wordpress"
containerName="wordpress"
tagNameSuffix=$(date +%s)
tagNameSuffix="deploy-${tagNameSuffix}"
tagName="$gcpRepoHostname"/"$gcpProjectId"/"$imageName":$tagNameSuffix
echo "$GCLOUD_API_KEYFILE" | base64 --decode --ignore-garbage > ./gcloud-api-key.json
gcloud auth activate-service-account --key-file gcloud-api-key.json
gcloud config set project "$gcpProjectId"
sudo docker build "$rootPath"/wordpress/ -t "$tagName"
sudo gcloud docker -- push "$tagName"
kubectl set image deployment/wordpress "$containerName"="$tagName"
Strangely this worked when I modified the wordpress/Dockerfile
to be:
FROM rlesouef/alpine-nginx
If I change it to:
FROM wordpress:php7.1-fpm-alpine
COPY custom-entrypoint.sh /usr/local/bin/
I get a non responsive service - fails to connect to the external ip.
Heres is some debug information relating to the last change (wordpress image):
kubectl get pods
shows the following:
NAME READY STATUS RESTARTS AGE
wordpress-702001878-xb0b1 2/2 Running 0 8m
If I check the logs via kubectl logs wordpress-702001878-xb0b1 wordpress
:
[07-Aug-2017 15:13:14] NOTICE: fpm is running, pid 1
[07-Aug-2017 15:13:14] NOTICE: ready to handle connections
How can I diagnose this issue? I suppose I need to determine the exact docker image being currently run on the cluster / pods.
kubectl get pods
Note the pod name.
Then exec into the pod: kubectl exec -c wordpress -it wordpress-915256023-g68cr -- bash
I was then able to determine that the container was listening on port 9000 (by running netstat -l
). Which made me realize this isn't HTTP server, but the PHP-FPM (so some other form of server).