<p>I'm working with microk8s using Kubernetes 1.19. The provided ingress.yaml does not work. Given my troubleshooting below, it seems like ngnix cannot connect to the default-http-backend. Microk8s was installed on a ubuntu 20.04 using snap. I know that there exists a ingress addon. But nonetheless, I would like it to work with this setup.</p>
<p><strong>microk8s kubectl get pods --all-namespaces</strong></p>
<pre><code>kube-ingress           default-http-backend-7744d88f46-45vp7        1/1     Running            0          53m
kube-ingress           nginx-74dd8dd664-7cn67                       0/1     CrashLoopBackOff   15         53m
</code></pre>
<p><strong>microk8s kubectl logs -n kube-ingress nginx-74dd8dd664-7cn67</strong></p>
<pre><code>W1014 08:28:14.903056       6 flags.go:249] SSL certificate chain completion is disabled (--enable-ssl-chain-completion=false)
W1014 08:28:14.903143       6 client_config.go:543] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I1014 08:28:14.903398       6 main.go:220] Creating API client for https://10.152.183.1:443
I1014 08:28:14.910869       6 main.go:264] Running in Kubernetes cluster version v1.19+ (v1.19.2-34+1b3fa60b402c1c) - git (clean) commit 1b3fa60b402c1c4cb0df8a99b733ad41141a2eb7 - platform linux/amd64
F1014 08:28:14.913646       6 main.go:91] No service with name kube-ingress/default-http-backend found: services &quot;default-http-backend&quot; not found
</code></pre>
<p><strong>ingress.yml</strong></p>
<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: kube-ingress
---
kind: ConfigMap
metadata:
  namespace: kube-ingress
  name: nginx
apiVersion: v1
data:
  proxy-connect-timeout: &quot;15&quot;
  proxy-read-timeout: &quot;600&quot;
  proxy-send-timeout: &quot;600&quot;
  hsts-include-subdomains: &quot;false&quot;
  body-size: &quot;200m&quot;
  server-name-hash-bucket-size: &quot;256&quot;
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: default-http-backend
  namespace: kube-ingress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: default-http-backend
  template:
    metadata:
      labels:
        app: default-http-backend
    spec:
      containers:
      - name: default-http-backend
        # Any image is permissable as long as:
        # 1. It serves a 404 page at /
        # 2. It serves 200 on a /healthz endpoint
        image: gcr.io/google_containers/defaultbackend:1.0
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 5
        ports:
        - containerPort: 8080
        resources:
          limits:
            cpu: 10m
            memory: 20Mi
          requests:
            cpu: 10m
            memory: 20Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: kube-ingress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      serviceAccountName: nginx
      containers:
      - image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.31.0
        name: nginx
        imagePullPolicy: Always
        env:
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
        livenessProbe:
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 5
        ports:
        - containerPort: 80
        - containerPort: 443
        args:
        - /nginx-ingress-controller
        - --default-backend-service=kube-ingress/default-http-backend
        - --configmap=kube-ingress/nginx
---
kind: ServiceAccount
apiVersion: v1
metadata:
  name: nginx
  namespace: kube-ingress
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nginx-ingress-newrole
rules:
  - apiGroups:
      - &quot;&quot;
    resources:
      - services
    verbs:
      - get
      - list
      - watch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nginx-ingress-newrole
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: nginx-ingress-newrole
subjects:
- kind: ServiceAccount
  name: nginx
  namespace: kube-ingress
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nginx-ingress-clusterole
rules:
  - apiGroups:
      - &quot;&quot;
    resources:
      - services
    verbs:
      - get
      - list
      - watch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: nginx-ingress-clusterole
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: nginx-ingress-clusterole
subjects:
- kind: ServiceAccount
  name: nginx
  namespace: kube-ingress
</code></pre>

<h2>Issue</h2>
<p>As mentioned in the logs</p>
<pre><code>No service with name kube-ingress/default-http-backend found: services &quot;default-http-backend&quot; not found
</code></pre>
<p>The main issue here was the lack of <code>default-http-backend</code> service in <code>kube-ingress</code> namespace.</p>
<h2>Solution</h2>
<p>The solution here is to simply add the <code>default-http-backend</code> <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">service</a>.</p>
<p>You can create it with <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#creating-a-service" rel="nofollow noreferrer">kubectl expose</a> or <a href="https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service" rel="nofollow noreferrer">yaml</a> file.</p>
