AKS crashloopbackoff when trying to run as a non root user

8/6/2021

I am trying to run a .net application on AKS. I am building the image using a docker file and using a deployment file to deploy on aks from container registry. Its fails showing status as CrashLoopBackOff.

docker file with user and group creation security context details in deployment.yaml file

-- Shashank Karukonda
azure
azure-aks
kubernetes

1 Answer

8/10/2021

I had to change the port to 8080 and it worked after that . It seems we cannot use port 80 for a non root user

and made the following changes in docker file

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
RUN addgroup --system  --gid 1000  custom-group && adduser --system --uid 1000 --ingroup custom-group --shell /bin/sh customuser
USER 1000
WORKDIR /app

#Serve on port 8080, we cannot serve on port 80 with a custom user that is not root
ENV ASPNETCORE_URLS http://+:8080
EXPOSE 8080
-- Shashank Karukonda
Source: StackOverflow