0

I am having some issue with creating ingress for a nginx service that I deployed in a kubernetes cluster. I am able to open the web page using port forwarding, so I think the service should work.The issue might be with configuring the ingress.I checked for selector, different ports, but still could not find where goes wrong. Anyone could help ? Thank you in advance.

# Source: django/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: vehement-horse-django-config
  labels:
    app.kubernetes.io/name: django
    helm.sh/chart: django-0.0.1
    app.kubernetes.io/instance: vehement-horse
    app.kubernetes.io/managed-by: Tiller
    enter code here

data:
---
# Source: django/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: vehement-horse-django
  labels:
    app.kubernetes.io/name: django
    helm.sh/chart: django-0.0.1
    app.kubernetes.io/instance: vehement-horse
    app.kubernetes.io/managed-by: Tiller
spec:
  type: ClusterIP
  ports:
    - port: 80
      targetPort: 8080
      protocol: TCP
      name: 
  selector:
    app.kubernetes.io/name: django
    app.kubernetes.io/instance: vehement-horse
---
# Source: django/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vehement-horse-django
  labels:
    app.kubernetes.io/name: django
    helm.sh/chart: django-0.0.1
    app.kubernetes.io/instance: vehement-horse
    app.kubernetes.io/managed-by: Tiller
spec:
  replicas: 
  selector:
    matchLabels:
      app.kubernetes.io/name: django
      app.kubernetes.io/instance: vehement-horse
  template:
    metadata:
      labels:
        app.kubernetes.io/name: django
        app.kubernetes.io/instance: vehement-horse
    spec:
      containers:
        - name: django
          image: "website:72cf09525f2da01706cdb4c6131e8bf1802ea6a3"
          imagePullPolicy: Always
          envFrom:
          - configMapRef:
              name: vehement-horse-django-config
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          resources:
            limits:
              cpu: 1
              memory: 1Gi
            requests:
              cpu: 1
              memory: 512Mi
            
      imagePullSecrets:
        - name: some-secret
---
# Source: django/templates/ingress.yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: vehement-horse-django
  labels:
    app.kubernetes.io/name: django
    helm.sh/chart: django-0.0.1
    app.kubernetes.io/instance: vehement-horse
    app.kubernetes.io/managed-by: Tiller
spec:
  rules:
    - host: something.com
      http:
        paths:
          - path: /
            backend:
              serviceName: vehement-horse-django
              servicePort: http
1

i'm guessing the problem is that the name of the service port is not configured, and in the ingress you specified the http name and it can not find it. name your port http , or give the port that you want to use (80) to the servicePort in the ingress file

1
  • This is actually really helpful. It is indeed the name of the service port issue. It works when I put 80 instead of http.
    – Sumei Xu
    May 14 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.