<p>I don't undestand why i can't get certificates on K8S using <strong>cert-manager</strong></p>
<ul>
<li><p>I installed cert-manager : <a href="https://github.com/cert-manager/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml" rel="nofollow noreferrer">https://github.com/cert-manager/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml</a></p>
</li>
<li><p>I created ClusterIssuer</p>
<pre><code>apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-staging
spec:
  acme:
    email: user@example.com
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: example-issuer-account-key
    solvers:
    - http01:
        ingress:
          class: nginx
</code></pre>
</li>
<li><p>I created ingress</p>
<pre><code>apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: letsencrypt-staging
spec:
  rules:
    - host: mytest.example.fr
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: webapp
                port:
                  number: 80
  tls:
    - hosts:
        - mytest.example.fr
      secretName: letsencrypt-staging
</code></pre>
</li>
</ul>
<p><a href="https://i.stack.imgur.com/IPWtg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IPWtg.png" alt="enter image description here" /></a></p>
<p>But when i try to get an certificate i get 'no resources found'
<a href="https://i.stack.imgur.com/0kXSe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0kXSe.png" alt="enter image description here" /></a></p>
<p>Any idea ?</p>
<p>Thank you for your help</p>

<p>If you don't want to create <strong>kind certificate</strong> you can use</p>
<pre><code>apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
  name: cluster-issuer-name
  namespace: development
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: harsh@example.com
    privateKeySecretRef:
      name: secret-name
    solvers:
    - http01:
        ingress:
          class: nginx-class-name
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx-class-name
    cert-manager.io/cluster-issuer: cluster-issuer-name
    nginx.ingress.kubernetes.io/rewrite-target: /
  name: example-ingress
spec:
  rules:
  - host: sub.example.com
    http:
      .
      . #Path and service configs
      .
      .
  tls:
  - hosts:
    - sub.example.com
    secretName: secret-name
</code></pre>
<p><strong>ingress</strong> will call <strong>clusterisser</strong> and it will auto-create <strong>certificate</strong> for you.</p>
<p>Update <strong>ingress</strong> resources as per need if you are higher version <strong>1.18</strong> or <strong>above</strong></p>
<p><strong>Notes</strong></p>
<ul>
<li><p>Make sure you are using the URL <code>https://acme-v02.api.letsencrypt.org/directory</code> in clusterissue or else you will get <strong>fake</strong> certificate in browser.</p>
</li>
<li><p>For refrence you can read more here :
<a href="https://stackoverflow.com/a/55183209/5525824">https://stackoverflow.com/a/55183209/5525824</a></p>
</li>
<li><p>Make sure also you ingress pointing to proper <strong>clusterissuer</strong> if
you have created new.</p>
</li>
<li><p>Also don't use same <strong>privateKeySecretRef:name: secret-name</strong> you
need to delete it or use the <strong>new</strong> <strong>name</strong> as <strong>fake certificate</strong>
now stored in that secret so.</p>
</li>
</ul>
