You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/12/19 05:50:01 UTC

[GitHub] [apisix-ingress-controller] cr7258 opened a new pull request, #1543: docs: add match stream route with SNI tutorial

cr7258 opened a new pull request, #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543

   <!-- Please answer these questions before submitting a pull request -->
   
   ### Type of change:
   
   <!-- Please delete options that are not relevant. -->
   
   - [ ] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   <!--
   Please follow the requirements:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. Use "request review" to notify the reviewer once you have resolved the review
   -->
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix-ingress-controller#community) first**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 commented on pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#issuecomment-1365004329

   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] navendu-pottekkat merged pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
navendu-pottekkat merged PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 commented on pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#issuecomment-1358751899

   Please check the lint error


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] shreemaan-abhishek commented on a diff in pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
shreemaan-abhishek commented on code in PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#discussion_r1057190794


##########
docs/en/latest/tutorials/match-stream-route-by-sni.md:
##########
@@ -0,0 +1,230 @@
+---
+title: Match Stream Route with SNI
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+SNI(Server Name Indication) is an extension to the TLS protocol which allows a client to indicate which hostname it is attempting to connect to at the start of the TCP handshaking process.
+Instead of requiring a different IP address for each SSL site, you can use SNI to install and configure multiple SSL sites to one IP address.
+
+This guide walks through how to use the ApisixTls and ApisixRoute to route TLS-encrypted traffic to the TCP-based services with SNI.
+
+## Prerequisites
+
+- an available Kubernetes cluster.
+- an available APISIX and APISIX Ingress Controller installation.
+
+First of all, when installing APISIX, we need to enable TLS for the TCP address for APISIX in the Helm Chart, assume that enable tls on TCP port 6379.

Review Comment:
   ```suggestion
   First of all, when installing APISIX, we need to enable TLS for the TCP address for APISIX in the Helm Chart, assume that TLS is enabled on TCP port 6379.
   ```



##########
docs/en/latest/tutorials/match-stream-route-by-sni.md:
##########
@@ -0,0 +1,230 @@
+---
+title: Match Stream Route with SNI
+---
+
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+SNI(Server Name Indication) is an extension to the TLS protocol which allows a client to indicate which hostname it is attempting to connect to at the start of the TCP handshaking process.
+Instead of requiring a different IP address for each SSL site, you can use SNI to install and configure multiple SSL sites to one IP address.
+
+This guide walks through how to use the ApisixTls and ApisixRoute to route TLS-encrypted traffic to the TCP-based services with SNI.
+
+## Prerequisites
+
+- an available Kubernetes cluster.
+- an available APISIX and APISIX Ingress Controller installation.
+
+First of all, when installing APISIX, we need to enable TLS for the TCP address for APISIX in the Helm Chart, assume that enable tls on TCP port 6379.
+
+```yaml
+gateway:
+  # L4 proxy (TCP/UDP)
+  stream:
+    enabled: true
+    tcp:
+      - addr: 6379
+        tls: true
+    udp: []
+```
+
+## Deploy Redis service
+
+Before configuring the APISIX, we need to create 2 Redis services for testing.
+
+```yaml
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: redis-1
+  name: redis-1
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: redis-1
+  template:
+    metadata:
+      labels:
+        app: redis-1
+    spec:
+      containers:
+      - image: redis:6.2.7
+        name: redis
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: redis-1
+  name: redis-1
+spec:
+  ports:
+  - port: 6379
+    protocol: TCP
+    targetPort: 6379
+  selector:
+    app: redis-1
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  labels:
+    app: redis-2
+  name: redis-2
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: redis-2
+  template:
+    metadata:
+      labels:
+        app: redis-2
+    spec:
+      containers:
+      - image: redis:6.2.7
+        name: redis
+---
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    app: redis-2
+  name: redis-2
+spec:
+  ports:
+  - port: 6379
+    protocol: TCP
+    targetPort: 6379
+  selector:
+    app: redis-2
+```
+
+## Create the certificates
+
+When using SNI with TLS, a valid certificate is required for each domain or hostname that you want to use with SNI.
+This is because SNI allows multiple hostnames to be served from the same IP address and port, and the certificate is used to verify the identity of the server and establish an encrypted connection with the client.
+
+Use OpenSSL to generate the certificate file and the key file for 2 Redis services.
+
+```bash
+openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout redis-1.key -out redis-1.crt -subj "/CN=redis-1.com"
+openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout redis-2.key -out redis-2.crt -subj "/CN=redis-2.com"
+```
+
+Use kubectl with the tls secret type to create the Secrets using the certificate file and the key file.
+
+```bash
+kubectl create secret tls redis-1-secret --cert=./redis-1.crt --key=./redis-1.key
+kubectl create secret tls redis-2-secret --cert=./redis-2.crt --key=./redis-2.key
+```
+
+## Create ApisixTls associated with Secret
+
+Create ApisixTls associated with Secret resource, note the hosts field should match the domain or hostname in the certificate.
+The apisix-ingress-controller will generate an APISIX SSL object in the APISIX.
+
+```yaml
+apiVersion: apisix.apache.org/v2
+kind: ApisixTls
+metadata:
+  name: redis-1-tls
+spec:
+  hosts:
+    - redis-1.com
+  secret:
+    name: redis-1-secret
+    namespace: default
+---
+apiVersion: apisix.apache.org/v2
+kind: ApisixTls
+metadata:
+  name: redis-2-tls
+spec:
+  hosts:
+    - redis-2.com
+  secret:
+    name: redis-2-secret
+    namespace: default
+```
+
+## Create ApisixRoute match the stream route with SNI

Review Comment:
   ```suggestion
   ## Create ApisixRoute that matches the stream route with SNI
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] tao12345666333 commented on pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#issuecomment-1365005092

   @navendu-pottekkat PTAL, Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] cr7258 closed pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
cr7258 closed pull request #1543: docs: add match stream route with SNI tutorial
URL: https://github.com/apache/apisix-ingress-controller/pull/1543


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] cr7258 commented on pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
cr7258 commented on PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#issuecomment-1358928680

   I fix the lint error.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] cr7258 commented on pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
cr7258 commented on PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#issuecomment-1358927084

   > 
   
   D


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-ingress-controller] navendu-pottekkat commented on pull request #1543: docs: add match stream route with SNI tutorial

Posted by GitBox <gi...@apache.org>.
navendu-pottekkat commented on PR #1543:
URL: https://github.com/apache/apisix-ingress-controller/pull/1543#issuecomment-1365092425

   Will update and index in a different PR as the "tutorials" section is being updated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org