I’m trying to deploy an application with a NodePort Service on Kubernets cluster, but the deployment doesn’t work, and the pods are in a CrashLoopBackOff state with this logs:
panic: pq: password authentication failed for user “go”
goroutine 1 [running]:
main.main()
/server/main.go:15 +0x1f4
This is the manifest of the app :
apiVersion: apps/v1
kind: Deployment
metadata:
name: go-angular-app
spec:
replicas: 3
selector:
matchLabels:
app: go-angular-app
template:
metadata:
labels:
app: go-angular-app
spec:
containers:
- name: go-angular-app
image: xxxxx
ports: - containerPort: 8080
env: - name: POSTGRES_USER
value: “go” - name: POSTGRES_PASSWORD
value: “root” - name: POSTGRES_DB
value: “go” - name: POSTGRES_HOST
value: “students-db-svc”
And this is the manifest of the service of the app :
apiVersion: v1
kind: Service
metadata:
name: go-angular-service
spec:
type: NodePort
selector:
app: go-angular-app
ports:
- protocol: TCP
port: 80
targetPort: 8080
nodePort: 30081
And this is the manifest of the Postgress deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: students-db
spec:
replicas: 1
selector:
matchLabels:
app: students-db
template:
metadata:
labels:
app: students-db
spec:
containers:
- name: postgres
image: postgres:11.5
ports: - containerPort: 5432
env: - name: POSTGRES_USER
value: “go” - name: POSTGRES_PASSWORD
value: “root”
name: POSTGRES_DB
value: “go”
and this is the db service manifest :
apiVersion: v1
kind: Service
metadata:
name: students-db-svc
spec:
selector:
app: students-db
ports:
- protocol: TCP
port: 5432
targetPort: 5432
I tried changing the environment variables and nothing has changed the pods are always on that state and they are supposed to be in RUNNING state What to do ? and thank you.