Setting up Ingress Kubernetes

0 votes

I’m trying to set up an ingress which routes traffic to my underlying services. But I end up getting an error when I deploy my ingress-controller-deploymnet.yaml file. The pod with the ingress-controller crashes immediately with error message “CrashLoopBackOff”

Pod description:

    Name:           ingress-controller-7749c785f-x94ll
    Namespace:      ingress
    Node:           gke-cluster-1-default-pool-8484e77d-r4wp/10.128.0.2
    Start Time:     Thu, 26 Apr 2018 14:25:04 +0200
    Labels:         k8s-app=nginx-ingress-lb
                    pod-template-hash=330573419
    Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"ingress","name":"ingress-controller-7749c785f","uid":"d8ff0a6d-494c-11e8-a840
    -420...
    Status:         Running
    IP:             10.8.0.14
    Created By:     ReplicaSet/ingress-controller-7749c785f
    Controlled By:  ReplicaSet/ingress-controller-7749c785f
    Containers:
      nginx-ingress-controller:
        Container ID:  docker://5654c7dffc44510132cba303d66ee570280f2cec235e4d4fa6ef8ad543e0c91d
        Image:         quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
        Image ID:      docker-pullable://quay.io/kubernetes-ingress-controller/nginx-ingress-controller@sha256:39cc6ce23e5bcdf8aa78bc28bbcfe0999e449bf99fe2e8d60984b417facc5cd4
        Ports:         80/TCP, 443/TCP
        Args:
          /nginx-ingress-controller
          --admin-backend-svc=$(POD_NAMESPACE)/admin-backend
        State:          Waiting
          Reason:       CrashLoopBackOff
        Last State:     Terminated
          Reason:       Error
          Exit Code:    2
          Started:      Thu, 26 Apr 2018 14:26:57 +0200
          Finished:     Thu, 26 Apr 2018 14:26:57 +0200
        Ready:          False
        Restart Count:  4
        Liveness:       http-get http://:10254/healthz delay=10s timeout=5s period=10s #success=1 #failure=3
        Environment:
          POD_NAME:       ingress-controller-7749c785f-x94ll (v1:metadata.name)
          POD_NAMESPACE:  ingress (v1:metadata.namespace)
        Mounts:
          /var/run/secrets/kubernetes.io/serviceaccount from default-token-plbss (ro)
    Conditions:
      Type           Status
      Initialized    True
      Ready          False
      PodScheduled   True
    Volumes:
      default-token-plbss:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  default-token-plbss
        Optional:    false
    QoS Class:       BestEffort
    Node-Selectors:  <none>
    Tolerations: node.alpha.kubernetes.io/notReady:NoExecute for 300s
node.alpha.kubernetes.io/unreachable:NoExecute for 300s

Ingress-controller-deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: ingress-controller
spec:
  replicas: 1
  revisionHistoryLimit: 3
  template:
    metadata:
      labels:
        k8s-app: nginx-ingress-lb
    spec:
      containers:
        - args:
            - /nginx-ingress-controller
            - "--admin-backend-svc=$(POD_NAMESPACE)/admin-backend"
          env:
            - name: POD_NAME
             valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          image: "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0"
          imagePullPolicy: Always
          livenessProbe:
            httpGet:
              path: /healthz
             port: 10254
              scheme: HTTP
            initialDelaySeconds: 10
            timeoutSeconds: 5
          name: nginx-ingress-controller
          ports:
            - containerPort: 80
              name: http
              protocol: TCP
            - containerPort: 443
              name: https
              protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: ingress-svc
spec:
  type: LoadBalancer
  ports:
  - name: http
    port: 80
    targetPort: http
  - name: https
    port: 443
    targetPort: https
  selector:
    k8s-app: nginx-ingress-lb
Sep 11, 2018 in Kubernetes by lina
• 8,220 points
1,105 views

2 answers to this question.

0 votes

The issue is the args. Try setting your args in the following manner:

      args:

        - /nginx-ingress-controller
        - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
        - --configmap=$(POD_NAMESPACE)/nginx-configuration
        - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
        - --udp-services-configmap=$(POD_NAMESPACE)/udp-services
        - --publish-service=$(POD_NAMESPACE)/ingress-nginx
        - --annotations-prefix=nginx.ingress.kubernetes.io
answered Sep 11, 2018 by Kalgi
• 52,350 points
0 votes

Also try creating the config maps for configuration, tcp and udp

answered Sep 11, 2018 by Hannah
• 18,520 points

Related Questions In Kubernetes

0 votes
1 answer

How do you set-up Mongo replica set on Kubernetes?

Follow these steps To create a Kubernetes 1.5 ...READ MORE

answered Aug 30, 2018 in Kubernetes by Kalgi
• 52,350 points
2,010 views
0 votes
1 answer

Forcing ssl for Kubernetes Ingress on GKE

https://github.com/kubernetes/ingress-gce#frontend-https If you want to block http, you ...READ MORE

answered Sep 6, 2018 in Kubernetes by ajs3033
• 7,300 points
4,221 views
0 votes
2 answers

Deny access to some specific paths while using kubernetes ingress

Try to create two Ingresses first by default ...READ MORE

answered Sep 21, 2018 in Kubernetes by Nilesh
• 7,060 points
12,054 views
+1 vote
1 answer
0 votes
1 answer

Kubernetes nginx-ingress TLS issue

You have to create a secret named test-secret. ➜ ...READ MORE

answered Sep 11, 2018 in Kubernetes by Kalgi
• 52,350 points
1,969 views
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,456 views
0 votes
3 answers

Error while setting up kubernetes

echo "1" > /proc/sys/net/bridge/bridge-nf-call-iptables READ MORE

answered May 16, 2019 in Kubernetes by sivashankar
16,958 views
0 votes
3 answers

Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) while setting up kubernetes

Execute these three commands: sudo rm /var/lib/apt/lists/lock sudo rm ...READ MORE

answered Nov 27, 2018 in Kubernetes by Maverick
• 10,840 points
1,813 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP