<p>I have 3 VMS running in localsystemeach 1 Master, 2 Nodes. I have installed weave CNI Network. I am trying to install the  Nginx ingress controller with</p>
<pre><code>kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml
</code></pre>
<p>But im unable to create it. I have tried the same with the AWS Ec2 instances. It is always crashing
<a href="https://i.stack.imgur.com/XS4Ot.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XS4Ot.png" alt="get pods -A" /></a>
I have seen the describe
getting this error in admission-create pod <code>MountVolume.SetUp failed for volume &quot;kube-api-access-kdhpc&quot; : object &quot;ingress-nginx&quot;/&quot;kube-root-ca.crt&quot; not registered</code></p>
<p>and the admission-patch,controller  pod is keep on restarting
the controller pod output <a href="https://i.stack.imgur.com/sheRe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sheRe.png" alt="ingress-ngnix-controlled" /></a>
Im kinda struck over here. I have tried using the flannel cni too and the result is the same.
Any suggestions are appreciated.</p>

raza sikander
<p>Try these steps, these configurations worked with me well.</p>
<h2>Ingress Controller</h2>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingress-controller
  namespace: ingress-space
spec:
  replicas: 1
  selector:
    matchLabels:
      name: nginx-ingress
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        name: nginx-ingress
    spec:
      containers:
      - args:
        - /nginx-ingress-controller
        - --configmap=$(POD_NAMESPACE)/nginx-configuration
        - --default-backend-service=app-space/default-http-backend
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.21.0
        imagePullPolicy: IfNotPresent
        name: nginx-ingress-controller
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          name: https
          protocol: TCP
      restartPolicy: Always
      serviceAccount: ingress-serviceaccount
      serviceAccountName: ingress-serviceaccount
      terminationGracePeriodSeconds: 30
</code></pre>
<h2>Ingress Service</h2>
<p>Apply this NodePort or LoadBalancer as per your configurations:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: ingress
  namespace: ingress-space
spec:
  ports:
  - name: http
    nodePort: 30080
    port: 80
    protocol: TCP
    targetPort: 80
  - name: https
    nodePort: 31640
    port: 443
    protocol: TCP
    targetPort: 443
  selector:
    name: nginx-ingress
  type: NodePort
</code></pre>
<h2>Role for Ingress</h2>
<p>You will need to create a service account for the ingress, any name of your choice, apply these <em>rbac</em> Cluster Role and Cluster Role Binding</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: ingress-role
rules:
- apiGroups:
  - &quot;&quot;
  resources:
  - services
  - endpoints
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - &quot;&quot;
  resources:
  - secrets
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - &quot;&quot;
  resources:
  - configmaps
  verbs:
  - get
  - list
  - watch
  - update
  - create
- apiGroups:
  - &quot;&quot;
  resources:
  - pods
  verbs:
  - list
  - watch
- apiGroups:
  - &quot;&quot;
  resources:
  - events
  verbs:
  - create
  - patch
  - list
- apiGroups:
  - networking.k8s.io
  - extensions
  resources:
  - ingresses
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - networking.k8s.io
  resources:
  - ingressclasses
  verbs:
  - get
- apiGroups:
  - networking.k8s.io
  - extensions
  resources:
  - ingresses/status
  verbs:
  - update
- apiGroups:
  - k8s.nginx.org
  resources:
  - virtualservers
  - virtualserverroutes
  - globalconfigurations
  - transportservers
  - policies
  verbs:
  - list
  - watch
  - get
- apiGroups:
  - k8s.nginx.org
  resources:
  - virtualservers/status
  - virtualserverroutes/status
  - policies/status
  - transportservers/status
  verbs:
  - update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: ingress-role-binding
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ingress-role
subjects:
- kind: ServiceAccount
  name: ingress-serviceaccount
  namespace: ingress-space
</code></pre>
<p>Your ingress source is ready to install, refer to <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/ingress/</a> and apply the ingress resource</p>
