간단한 TLS를 HTTPS로 인그레스 게이트웨이를 보호하고 특정 웹페이지에 대해 HTTPS 연결을 사용 설정할 수 있습니다. 또한 HTTP 연결을 HTTPS로 리디렉션할 수 있습니다.
HTTPS는 비보안 네트워크로 보안 채널을 만들어 중간자 공격으로부터 보호하고 클라이언트 및 서버 간 트래픽을 암호화합니다. 웹 서버가 HTTPS 연결을 수락하도록 준비하려면 관리자가 서버에 대해 공개 키 인증서를 만들어야 합니다. 웹브라우저가 이 인증서를 경고 없이 수락할 수 있으려면 신뢰할 수 있는 인증 기관의 서명이 있어야 합니다.
기본 제공되는 Kubernetes 편집기를 사용하여 kf 네임스페이스에서 external-gateway라는 게이트웨이를 수정합니다.
kubectl edit gateway -n kf external-gateway
서비스에 대한 인증서 및 키가 있다고 가정하고 인그레스 게이트웨이를 위해 Kubernetes 보안 비밀을 만듭니다. 보안 비밀 이름은 istio 또는 prometheus로 시작하지 않아야 합니다. 이 예시에서 보안 비밀 이름은 myapp-https-credential입니다.
servers: 아래에서 다음 안내를 따르세요.
포트 443에 대한 섹션을 추가합니다.
tls: 아래에서 credentialName을 방금 만든 보안 비밀의 이름으로 설정합니다.
hosts: 아래에서 HTTPS로 보호하려는 서비스의 호스트 이름을 추가합니다. 와일드 카드(예: *.example.com)를 사용하여 전체 도메인으로 설정하거나 단일 호스트 이름(예: myapp.example.com)으로 범위를 지정할 수 있습니다.
servers: 아래에 포트 80 HTTP에 대한 섹션이 있습니다. 모든 트래픽이 HTTP로 수신되도록 하려면 게이트웨이 정의에 이 섹션을 유지합니다.
HTTP를 HTTPS로 리디렉션하려면 HTTP 서버 섹션의 tls 아래에 httpsRedirect: true 값을 추가합니다. 자세한 내용은 Istio 게이트웨이 문서를 참조하세요. hosts가 *로 설정된 섹션에서 이 값을 추가하면 모든 트래픽이 HTTPS로 리디렉션됩니다. 단일 앱/도메인에 대해서만 HTTP를 HTTPS로 리디렉션하려면 리디렉션을 지정하는 개별 HTTP 섹션을 추가합니다.
다음은 myapp.example.com 에 대해 HTTPS를 설정하고 해당 호스트에 대해 HTTP를 HTTPS로 리디렉션하는 게이트웨이 spec 예시입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 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"]]