14.7. Déploiement d’une application d’échantillon
Désormais que les certificats dynamiques sont configurés, vous pouvez déployer un exemple d’application pour confirmer que les certificats sont fournis et fiables lorsque vous exposez un nouvel itinéraire.
Créez un nouveau projet pour votre exemple d’application:
$ oc new-project hello-worldDéployez une application hello world:
$ oc -n hello-world new-app --image=docker.io/openshift/hello-openshiftCréer un itinéraire pour exposer l’application à partir de l’extérieur du cluster:
$ oc -n hello-world create route edge --service=hello-openshift hello-openshift-tls --hostname hello.${DOMAIN}La vérification du certificat de l’itinéraire n’est pas fiable:
$ curl -I https://hello.${DOMAIN}Exemple de sortie
curl: (60) SSL: no alternative certificate subject name matches target host name 'hello.example.com' More details here: https://curl.se/docs/sslcerts.html curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.Annoter l’itinéraire pour déclencher cert-manager pour fournir un certificat pour le domaine personnalisé:
$ oc -n hello-world annotate route hello-openshift-tls cert-manager.io/issuer-kind=ClusterIssuer cert-manager.io/issuer-name=letsencrypt-productionNoteIl faut 2-3 minutes pour que le certificat soit créé. Le renouvellement du certificat sera automatiquement géré par l’opérateur responsable du certificat à l’approche de l’expiration.
La vérification du certificat de l’itinéraire est désormais fiable:
$ curl -I https://hello.${DOMAIN}Exemple de sortie
HTTP/2 200 date: Thu, 05 Oct 2023 23:45:33 GMT content-length: 17 content-type: text/plain; charset=utf-8 set-cookie: 52e4465485b6fb4f8a1b1bed128d0f3b=68676068bb32d24f0f558f094ed8e4d7; path=/; HttpOnly; Secure; SameSite=None cache-control: private