Background
I have a container that I have defined with an CMD
and an ENTRYPOINT
in Docker. When I run the following command my container runs with no issues whatsoever.
docker run --rm -ti custom-container:latest
Here is the definition for my container:
FROM mcr.microsoft.com/powershell:6.2.3-ubuntu-bionic
COPY . /app
WORKDIR /app
CMD ["/app/Start-Test.ps1"]
ENTRYPOINT ["pwsh", "-f", "/app/Start-Test.ps1"]
The script Start-Test.ps1
is just an infinite loop that writes Hello World!
to host.
Problem
When I go to run my container in Kubernetes, my container refuses to run.
Kubernetes is able to pull my image and it attempts to spin up the container, but I keep getting a status of BackedOff from Kubernetes.
I've gone through and tried to figure out why this is happening because the container runs perfectly fine in Docker.
I only have issues when I try to run the container in Kubernetes.
Here is the definition for my Kubernetes deployment.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: my-custom-container
spec:
replicas: 1
selector:
matchLabels:
app: my-custom-container
template:
metadata:
labels:
app: my-custom-container
spec:
containers:
- name: my-custom-container
image: repository-url.io/custom-container:latest
imagePullSecrets:
- name: regcred
Question
What is the issue preventing my container from running when it runs with no problems in Docker?
Additionally, yes I would like to use PowerShell as my entry point. It should be possible to use any scripting langauge (bash, Ruby, Python, Perl, etc) as an entry point.
kubectl logs <pod name>
. Please add the log data to your question.