Based on this document https://github.com/kubernetes/ingress/tree/master/examples/deployment/nginx/kubeadm I am creating nginx controller. but my controller is not starting. its giving below error message.
2017-05-21T17:15:45.274300000Z I0521 17:15:45.259441 1 launch.go:101] &{NGINX 0.9.0-beta.5 git-83cb03b5 git@github.com:ixdy/kubernetes-ingress.git}
2017-05-21T17:15:45.274448000Z I0521 17:15:45.259460 1 launch.go:104] Watching for ingress class: nginx
2017-05-21T17:15:45.274563000Z I0521 17:15:45.259620 1 launch.go:257] Creating API server client for https://10.96.0.1:443
2017-05-21T17:15:45.274670000Z I0521 17:15:45.258931 1 nginx.go:180] starting NGINX process...
2017-05-21T17:15:45.310531000Z F0521 17:15:45.303209 1 launch.go:118] no service with name kube-system/default-http-backend found: User "system:serviceaccount:kube-system:default" cannot get services in the namespace "kube-system". (get services default-http-backend)
I see default backend service running.
$ kubectl --kubeconfig=/c/software/k612_centos/admin.conf -n kube-system get po
NAME READY STATUS RESTARTS AGE
default-http-backend-2198840601-zt8gt 1/1 Running 0 6m
nginx-ingress-controller-4108150732-q2rb2 0/1 CrashLoopBackOff 6 6m
How to clear this error message?
Thanks SR
Here I found an example that is working find for me. Just for the record, I modified the RBAC to use the default service account of the nginx-ingress namespace because I already had a working gitlab installation that broke when enabling RBAC in the cluster.
Just in case the link becomes obsolete, I copy the RBAC settings below:
apiVersion: v1
kind: Namespace
metadata:
name: nginx-ingress
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: nginx-ingress-serviceaccount
namespace: nginx-ingress
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: nginx-ingress-clusterrole
rules:
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- nodes
- pods
- secrets
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- "extensions"
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- "extensions"
resources:
- ingresses/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: nginx-ingress-role
namespace: nginx-ingress
rules:
- apiGroups:
- ""
resources:
- configmaps
- pods
- secrets
verbs:
- get
- apiGroups:
- ""
resources:
- endpoints
verbs:
- get
- create
- update
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: nginx-ingress-role-nisa-binding
namespace: nginx-ingress
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: nginx-ingress-role
subjects:
- kind: ServiceAccount
name: nginx-ingress-serviceaccount
namespace: nginx-ingress
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: nginx-ingress-clusterrole-nisa-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: nginx-ingress-clusterrole
subjects:
- kind: ServiceAccount
name: nginx-ingress-serviceaccount
namespace: nginx-ingress
which kubernetes version are you using?
If you are using kubenetes 1.6.x you need to define RBAC rules for the controller to access the default-http-backend service and other required components.
Please refer to this issue
https://github.com/kubernetes/ingress/issues/575
The manifest file in the first comment worked fine for me.