Actually I follow the manuals https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app#console to deploy web application tutorial. I made docker file and image at my local directory. And I uploaded the image to google cloud platform-container registry. The image is pushed to registry is success. And then I made kubernetes cluster and try to deploy it. But container got error "CrashLoopBackOff".
I deleted clusters and pods few times but nothing's changed. Error messages appeare when just container start.
Follow the docs the error is 'pods repeated start and crashed' and solution is watching logs carefully...
I searched other users case: such like ImagePullPolicy : always / restartPolicy : always but error not solved... enter image description here
ps: By the pods log..errorcode is 0
pps: Now I try to change container's yaml file. The imagePullPolicy ifnotPresent
to Always
. But
Pod "nginx-1-99dcd4d9f-84szv" is invalid:
spec: Forbidden: pod updates may not change fields other than
`spec.containers[*].image`,
`spec.initContainers[*].image`,
`spec.activeDeadlineSeconds` or
`spec.tolerations` (only additions to existing tolerations)
core.PodSpec{
Volumes: []core.Volume{
{Name: "default-token-stk86", VolumeSource: core.VolumeSource{Secret: &core.SecretVolumeSource{SecretName: "default-token-stk86", DefaultMode: &420
}
}
}
}, InitContainers: nil, Containers: []core.Container{
{
TerminationMessagePath: "/dev/termination-log",
TerminationMessagePolicy: "File",
- ImagePullPolicy: "Always",
+ ImagePullPolicy: "IfNotPresent",
SecurityContext: nil,
Stdin: false,
},
}, EphemeralContainers: nil, RestartPolicy: "Always",
}
This error message appears.
Here is my Dockerfile. install settings and webpage for test 'phptest.php' To allow phptest.php I changed default file and init.sh
FROM ubuntu
RUN apt-get update && apt-get upgrade -y && \
apt-get -y install \
nginx \
vim \
php-fpm
COPY srcs/default /
COPY srcs/phptest.php /
COPY srcs/init.sh /
EXPOSE 80
CMD bash init.sh
init.sh is here
rm /etc/nginx/sites-available/default
mv default /etc/nginx/sites-available/
mv phptest.php /var/www/html
chown -R www-data /var/www/*
chmod -R 755 /var/www/*
service nginx start
service php7.4-fpm start
bash
I uploaded new task because the post question was not meet to stackoverflow's guideline