Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
É possível usar o TLS simples para proteger o gateway de entrada com HTTPS e ativar conexões HTTPS para páginas da Web específicas. Também é possível redirecionar conexões HTTP para HTTPS.
O HTTPS cria um canal seguro em uma rede não segura, protegendo contra ataques intermediários e criptografando o tráfego entre o cliente e o servidor. Para preparar um servidor da Web para aceitar conexões HTTPS, um administrador precisa criar um certificado de chave pública para o servidor. O certificado precisa ser assinado por uma autoridade de certificação confiável para que um navegador da Web aceite-o sem emitir avisos.
Edite o gateway chamado external-gateway no namespace kf usando o editor integrado do Kubernetes:
kubectl edit gateway -n kf external-gateway
Pressupondo que você tem um certificado e uma chave para o serviço, crie um secret do Kubernetes para o gateway de entrada. Verifique se o nome do secret não começa com istio ou prometheus. Neste exemplo, o secret é chamado de myapp-https-credential.
Em servers:
Adicione uma seção para a porta 443.
Em tls:, defina credentialName como o nome do secret que você acabou de criar.
Em hosts:, adicione o nome do host do serviço que você quer proteger com HTTPS. Isso pode ser definido como todo o domínio usando um caractere curinga (por exemplo, *.example.com) ou com escopo definido apenas para um nome de host (por exemplo, myapp.example.com).
É necessário que já exista uma seção em servers: para a porta 80 HTTP. Mantenha essa seção na definição do gateway se quiser que todo o tráfego entre como HTTP.
Para redirecionar HTTP para HTTPS, adicione o valor httpsRedirect: true em tls na seção do servidor HTTP. Consulte a documentação do gateway do Istio para referência. A adição na seção em que hosts é definido como * significa que todo o tráfego é redirecionado para HTTPS. Se quiser redirecionar o HTTP para HTTPS em um único app/domínio, adicione uma seção HTTP separada para especificá-lo.
Veja abaixo um exemplo de um gateway spec que configura HTTPS para myapp.example.com e redireciona HTTP para HTTPS para esse host:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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"]]