nginx ingress controller is not creating load balancer IP address in custom Kubernetes cluster

5/22/2018

I have a custom Kubernetes cluster created through kubeadm. My service is exposed through node port. Now I want to use ingress for my services.

I have deployed one application which is exposed through NodePort.

Below is my deployment.yaml:

apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ template "demochart.fullname" . }}
  labels:
    app: {{ template "demochart.name" . }}
    chart: {{ template "demochart.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ template "demochart.name" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "demochart.name" . }}
        release: {{ .Release.Name }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: 80
          volumeMounts:
            - name: cred-storage
              mountPath: /root/
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
      volumes:
        - name: cred-storage
          hostPath:
            path: /home/aodev/
            type:

Below is values.yaml

replicaCount: 3

image:
  repository: REPO_NAME
  tag: latest
  pullPolicy: IfNotPresent

service:
  type: NodePort
  port: 8007

resources:
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources, such as Minikube. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  limits:
    cpu: 1000m
    memory: 2000Mi
  requests:
    cpu: 1000m
    memory: 2000Mi

nodeSelector: {}

tolerations: []

affinity: {}

Now I have deployed nginx ingress controller from the following repository.

git clone https://github.com/samsung-cnct/k2-charts.git

helm install --namespace kube-system --name my-nginx k2-charts/nginx-ingress

Below is values.yaml file for nginx-ingress and its service is exposed through LoadBalancer.

# Options for ConfigurationMap
configuration:
  bodySize: 64m
  hstsIncludeSubdomains: "false"
  proxyConnectTimeout: 15
  proxyReadTimeout: 600
  proxySendTimeout: 600
  serverNameHashBucketSize: 256

ingressController:
  image: gcr.io/google_containers/nginx-ingress-controller
  version: "0.9.0-beta.8"
  ports:
  - name: http
    number: 80
  - name: https
    number: 443
  replicas: 2

defaultBackend:
  image: gcr.io/google_containers/defaultbackend
  version: "1.3"
  namespace:
  resources:
    memory: 20Mi
    cpu: 10m
  replicas: 1
  tolerations:
   # - key: taintKey
   #   value: taintValue
   #   operator: Equal
   #   effect: NoSchedule

ingressService:
  type: LoadBalancer
#  nodePorts:
#  - name: http
#    port: 8080
#    targetPort: 80
#    protocol: TCP
#  - name: https
#    port: 8443
#    targetPort: 443
#    protocol: TCP
  loadBalancerIP:
  externalName:
  tolerations:
   # - key: taintKey
   #   value: taintValue
   #   operator: Equal

kubectl describe svc my-nginx

kubectl describe svc nginx-ingress --namespace kube-system
Name:                     nginx-ingress
Namespace:                kube-system
Labels:                   chart=nginx-ingress-0.1.2
                          component=my-nginx-nginx-ingress
                          heritage=Tiller
                          name=nginx-ingress
                          release=my-nginx
Annotations:              helm.sh/created=1526979619
Selector:                 k8s-app=nginx-ingress-lb
Type:                     LoadBalancer
IP:                       10.100.180.127
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  31378/TCP
Endpoints:                External-IP:80,External-IP:80
Port:                     https  443/TCP
TargetPort:               443/TCP
NodePort:                 https  32127/TCP
Endpoints:                External-IP:443,External-IP:443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

It is not creating an external IP address for nginx-ingress and it's showing pending status.

nginx-ingress          LoadBalancer   10.100.180.127   <pending>     80:31378/TCP,443:32127/TCP   20s

And my ingress.yaml is as follows

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  labels:
    app: {{ template "demochart.name" . }}
    chart: {{ template "demochart.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: test.example.com
    http:
      paths:
      - path: /entity
        backend:
          serviceName: testsvc
          servicePort: 30003

Is it possible to implement ingress in custom Kubernetes cluster through nginx-ingress-controller?

-- Pranita Kadge
kubernetes
kubernetes-helm
kubernetes-ingress
nginx

0 Answers