Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Sie können das Ingress-Gateway mit HTTPS mithilfe einfacher TLS sichern und HTTPS-Verbindungen zu bestimmten Webseiten aktivieren. Darüber hinaus können Sie HTTP-Verbindungen zu HTTPS weiterleiten.
HTTPS erstellt über ein unsicheres Netzwerk einen sicheren Kanal, der vor Man-in-the-Middle-Angriffen schützt und den Traffic zwischen Client und Server verschlüsselt. Damit ein Webserver HTTPS-Verbindungen akzeptieren kann, muss ein Administrator ein öffentliches Schlüsselzertifikat für den Server erstellen. Dieses Zertifikat muss von einer vertrauenswürdigen Zertifizierungsstelle für einen Webbrowser signiert werden, damit es ohne Ausgabe einer Warnmeldung akzeptiert wird.
Bearbeiten Sie das Gateway „external-gateway“ im Namespace kf mit dem eingebundenen Kubernetes-Editor:
kubectl edit gateway -n kf external-gateway
Wenn Sie für Ihren Dienst ein Zertifikat und einen Schlüssel haben, erstellen Sie für das Ingress-Gateway ein Kubernetes-Secret. Der Secret-Name darf nicht mit istio oder prometheus beginnen. In diesem Beispiel heißt das Secret myapp-https-credential.
Unter servers:
Fügen Sie einen Bereich für Port 443 hinzu.
Legen Sie unter tls: den credentialName auf den Namen des soeben erstellten Secrets fest.
Fügen Sie unter hosts: den Hostnamen des Dienstes hinzu, den Sie mit HTTPS sichern möchten. Hier können Sie mithilfe eines Platzhalters eine ganze Domain (z. B. *.example.com) oder einen einzelnen Hostnamen (z B. myapp.example.com) festlegen.
Unter servers: sollte bereits ein Bereich für den Port 80 HTTP vorhanden sein. Behalten Sie diesen Bereich in der Gateway-Definition bei, wenn der gesamte Traffic über HTTP empfangen werden soll.
Fügen Sie für die Weiterleitung von HTTP-Anfragen zu HTTPS im Bereich „HTTP-Server“ unter tls den Wert httpsRedirect: true hinzu. Weitere Informationen finden Sie in der Istio-Gateway-Dokumentation. Wenn Sie dies in dem Bereich hinzufügen, in dem hosts auf * gesetzt ist, wird der gesamte Traffic zu HTTPS weitergeleitet. Wenn Sie hingegen nur für eine einzelne Anwendung/Domain von HTTP zu HTTPS weiterleiten möchten, fügen Sie einen separaten HTTP-Bereich hinzu, in dem Sie die Weiterleitung explizit angeben.
Unten sehen Sie ein Beispiel für ein Gateway spec, für das HTTPS auf myapp.example.com gesetzt ist und mit dem HTTP für diesen Host an HTTPS weitergeleitet wird:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Setting up HTTPS Ingress\n\nYou can secure the ingress gateway with HTTPS by using simple TLS, and enable HTTPS connections to specific webpages. In addition, you can redirect HTTP connections to HTTPS.\n\nHTTPS creates a secure channel over an insecure network, protecting against man-in-the-middle attacks and encrypting traffic between the client and server. To prepare a web server to accept HTTPS connections, an administrator must create a public key certificate for the server. This certificate must be signed by a trusted certificate authority for a web browser to accept it without warning.\n| **Note:** These instructions supplement the Istio instructions to [configure a TLS ingress gateway](https://istio.io/latest/docs/tasks/traffic-management/ingress/secure-ingress), and assume that a valid certificate and private key for the server have already been created.\n\nEdit the gateway named external-gateway in the `kf` namespace using the built-in Kubernetes editor: \n\n```\nkubectl edit gateway -n kf external-gateway\n```\n\n1. Assuming you have a certificate and key for your service, create a Kubernetes secret for the ingress gateway. Make sure the secret name does not begin with `istio` or `prometheus`. For this example, the secret is named `myapp-https-credential`.\n2. Under `servers:`\n 1. Add a section for port 443.\n 2. Under `tls:`, set the `credentialName` to the name of the secret you just created.\n 3. Under `hosts:`, add the host name of the service you want to secure with HTTPS. This can be set to an entire domain using a wildcard (e.g. `*.example.com`) or scoped to just one hostname (e.g. `myapp.example.com`).\n3. There should already be a section under `servers:` for port 80 HTTP. Keep this section in the Gateway definition if you would like all traffic to come in as HTTP.\n4. To redirect HTTP to HTTPS, add the value `httpsRedirect: true` under `tls` in the HTTP server section. See the [Istio Gateway documentation](https://istio.io/latest/docs/reference/config/networking/gateway/) for reference. Note that adding this in the section where `hosts` is set to `*` means that **all** traffic is redirected to HTTPS. If you only want to redirect HTTP to HTTPS for a single app/domain, add a separate HTTP section specifying the redirect.\n\nShown below is an example of a Gateway `spec` that sets up HTTPS for `myapp.example.com` and redirects HTTP to HTTPS for that host: \n\n spec:\n selector:\n istio: ingressgateway\n servers:\n - hosts:\n - myapp.example.com\n port:\n name: https\n number: 443\n protocol: HTTPS\n tls:\n credentialName: myapp-https-credential\n mode: SIMPLE\n - hosts:\n - myapp.example.com\n port:\n name: http-my-app\n number: 80\n protocol: HTTP\n tls:\n httpsRedirect: true\n - hosts:\n - '*'\n port:\n name: http\n number: 80\n protocol: HTTP"]]