IBM / drupal-nginx-php-kubernetes

Demonstration of a set of NGINX and PHP-FPM containers running Drupal deployed to Kubernetes on the IBM Container Service.
Apache License 2.0
51 stars 35 forks source link

the kubernetes container deployment configuration yaml files have a hardcoded reference to the orod registry #129

Open kuilboer opened 5 years ago

kuilboer commented 5 years ago

Error msg form the kubernetes dashboard:

Failed to pull image "registry.ng.bluemix.net/orod/:": rpc error: code = Unknown desc = failed to resolve image "registry.ng.bluemix.net/orod/code-nginx:latest": failed to fetch anonymous token: unexpected status: 401 Unauthorized

Cause: The following files for their image refer statically to image: "registry.ng.bluemix.net/orod/<imagename>:<label>":

nginx-prd.yaml, nginx-stg.yaml php-fpm-prd.yaml, phpfpm-stg.yaml php-cli.yaml

Solution: Update documentation to reflect the fact that the yamls need to be reviewed and the image: line updated to reflect the right registry url and - namespace.

Alternative: Centralize the location for management of the registry url and - namespace It doesn't seem possible to use environment variables in the yaml files directly this can be solved using the shell command envsubst.

One way to centralize the management of the registry location is to export $REGISTRY_URL and $REGISTRY_NAMESPACE from the pipeline/rolling-code-deploy.sh script.

The yaml files need to be updated so that the image: line reads: image: "$REGISTRY_URL/$REGISTRY_NAMESPACE/<imagename>:<label>"

Using the shell command envsubst you can now substitute the $VARIABLE tags in the yaml files, for the actual value of the environment variable with the same name, before passing the yaml to kubectl for execution. To do this: The kubectl apply -f statements in the pipeline/rolling-code-deploy.sh script should be changed to:

envsubst < ../kubernetes/<yaml file> | kubectl apply -f - e.g.: envsubst < ../kubernetes/php-cli.yaml | kubectl apply -f -

Update the documentation to reflect these changes.