Create an L7 ingress resource which will trigger the creation of L7 Virtual Server and when the certificate is rotated using the following steps, NCP will replace the existing/old certificate.
Disclaimer:
If no L7 ingress resources are being used by the Supervisor or TKG clusters, and NSX-T is not being utilized for L7 services, you may skip the "Create Ingress" step and proceed directly to the "REPLACE CERT" section.
If you have an Ingress resource that exists already, you can skip the following steps and go to REPLACE CERT section.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cafe-ingress
annotations:
kubernetes.io/ingress.class: "nsx"
spec:
tls:
- hosts:
- cafe.example.com
secretName: cafe-secret
rules:
- host: cafe.example.com
http:
paths:
- path: /tea
pathType: ImplementationSpecific
backend:
service:
name: tea-svc
port:
number: 80
ingress.yaml is populated with the preceding contentkubectl apply -f ingress.yamlkubectl get ingress -ANSX Manager Networking -> Load Balancing -> Virtual Servers filter for Type L7 HTTP
System -> Certificates
kubectl delete -f ingress.yamlNote: This should not require any restart in NCP
Cluster -> Configure -> Supervisor Cluster -> Certificates -> NSX Load Balancer Pane -> Actions > Generate CSR
/usr/lib/vmware-vmca/bin/certool --gencertfromcsr --csrfile cert.csr --cert lb-renew.crtlb-renew.crt and replace it under Actions > Replace Certificate. NSX Manager -> System -> Certificates. The new certificate should be visible.(to delete the old certificate if it is sill present, per the Note in Step 6 of the REPLACE CERT section)
lb-domain-#### issued to defaultingress.local under System -> Certificates. Alternatively, this can be fetched using the following command:GET /policy/api/v1/infra/certificates/
compare pem_encoded or _create_time in the returned JSON.curl -k -u 'admin:<NSX_admin_Password>' -X DELETE https://<NSX_Manager>/policy/api/v1/infra/certificates/<Certificate_ID> -H "X-Allow-Overwrite:true
NCP pod. The NCP pod can be restarted by either touching NCP deployment or deleting NCP pod. This is required to sync the NCP certificate cache and will prevent the stale certificate from being referenced in future L7 VirtualServer creation calls.