Files
doc-exports/docs/cce/umn/cce_10_0697.html
qiujiandong1 71d5c814e7 CCE UMN 20250311 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2025-06-16 14:58:53 +00:00

68 lines
4.1 KiB
HTML

<a name="cce_10_0697"></a><a name="cce_10_0697"></a>
<h1 class="topictitle1">Configuring HTTPS Backend Services for an Nginx Ingress</h1>
<div id="body0000001535631974"><p id="cce_10_0697__p17862192012281">Ingress can function as a proxy for backend services using different protocols. By default, the backend proxy channel of an ingress is an HTTP channel. To create an HTTPS channel, add the following configuration to the <strong id="cce_10_0697__b7342191771312">annotations</strong> field:</p>
<pre class="codeblock" id="cce_10_0697__codeblock12862122016289">nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"</pre>
<p id="cce_10_0697__p28621020172820">An ingress configuration example is as follows:</p>
<ol id="cce_10_0697__ol189801125184912"><li id="cce_10_0697__li786172022818"><span>Use kubectl to access the cluster. For details, see <a href="cce_10_0107.html">Accessing a Cluster Using kubectl</a>.</span></li><li id="cce_10_0697__li20861202016283"><span>Create a YAML file named <strong id="cce_10_0697__b426761103103627">ingress-test.yaml</strong>. The file name can be customized.</span><p><pre class="screen" id="cce_10_0697__screen33111854124616">vi ingress-test.yaml</pre>
<div class="p" id="cce_10_0697__p1047412591211"><strong id="cce_10_0697__b1218153425104114">For clusters of v1.23 or later:</strong><pre class="screen" id="cce_10_0697__screen686216205284">apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-test
namespace: default
annotations:
<strong id="cce_10_0697__b19934132718265">nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"</strong>
spec:
tls:
- secretName: ingress-test-secret # Replace it with your TLS key certificate.
rules:
- host: ''
http:
paths:
- path: '/'
backend:
service:
name: &lt;your_service_name&gt; # Replace it with the name of your target Service.
port:
number: &lt;your_service_port&gt; # Replace it with the port number of your target Service.
property:
ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH
pathType: ImplementationSpecific
ingressClassName: nginx</pre>
</div>
<div class="p" id="cce_10_0697__p132988712139"><strong id="cce_10_0697__b275916365104131">For clusters of v1.21 or earlier:</strong><pre class="screen" id="cce_10_0697__screen1086242019288">apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-test
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
<strong id="cce_10_0697__b8863162017288">nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"</strong>
spec:
tls:
- secretName: ingress-test-secret # Replace it with your TLS key certificate.
rules:
- host: ''
http:
paths:
- path: '/'
backend:
serviceName: &lt;your_service_name&gt; # Replace it with the name of your target Service.
servicePort: &lt;your_service_port&gt; # Replace it with the port number of your target Service.</pre>
</div>
</p></li><li id="cce_10_0697__li849183943112"><span>Create an ingress.</span><p><pre class="screen" id="cce_10_0697__screen823365715489">kubectl create -f ingress-test.yaml</pre>
<p id="cce_10_0697__p5420131416240">If information similar to the following is displayed, the ingress has been created:</p>
<pre class="screen" id="cce_10_0697__screen1742018145243">ingress/ingress-test created</pre>
</p></li><li id="cce_10_0697__li14356174813496"><span>Check the created ingress.</span><p><pre class="screen" id="cce_10_0697__screen1736144819497">kubectl get ingress</pre>
<p id="cce_10_0697__p113611948114915">If information similar to the following is displayed, the ingress has been created:</p>
<pre class="screen" id="cce_10_0697__screen69661326114717">NAME CLASS HOSTS ADDRESS PORTS AGE
ingress-test nginx * 121.**.**.** 80 10s</pre>
</p></li></ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_10_0936.html">Advanced Setting Examples of Nginx Ingresses</a></div>
</div>
</div>