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-world
$ oc new-project hello-world
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Déployez une application hello world:
oc -n hello-world new-app --image=docker.io/openshift/hello-openshift
$ oc -n hello-world new-app --image=docker.io/openshift/hello-openshift
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Cré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}
$ oc -n hello-world create route edge --service=hello-openshift hello-openshift-tls --hostname hello.${DOMAIN}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow La vérification du certificat de l’itinéraire n’est pas fiable:
curl -I https://hello.${DOMAIN}
$ curl -I https://hello.${DOMAIN}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Exemple de sortie
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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-production
$ oc -n hello-world annotate route hello-openshift-tls cert-manager.io/issuer-kind=ClusterIssuer cert-manager.io/issuer-name=letsencrypt-production
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIl 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}
$ curl -I https://hello.${DOMAIN}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Exemple de sortie
Copy to Clipboard Copied! Toggle word wrap Toggle overflow