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/06/10 08:02:50 UTC

[GitHub] [apisix] liangyawang opened a new pull request, #7232: Update kubernetes.md

liangyawang opened a new pull request, #7232:
URL: https://github.com/apache/apisix/pull/7232

   添加自动发现类型为kubernetes的路由创建示例
   
   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   
   ### Checklist
   
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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] Maple521 commented on pull request #7232: docs: update kubernetes document

Posted by "Maple521 (via GitHub)" <gi...@apache.org>.
Maple521 commented on PR #7232:
URL: https://github.com/apache/apisix/pull/7232#issuecomment-1463357854

   My problem has been solved. Regarding serviceName, I deleted port 30000 and changed it to http so that it can work normally.
   ![image](https://user-images.githubusercontent.com/30151992/224245245-2885a557-b83b-4997-a57a-8e010d71ff1d.png)
   


-- 
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] hf400159 commented on a diff in pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #7232:
URL: https://github.com/apache/apisix/pull/7232#discussion_r894288435


##########
docs/zh/latest/discovery/kubernetes.md:
##########
@@ -147,6 +147,54 @@ nodes("default/plat-dev:3306") 调用会得到如下的返回值:
        },
    }
   ```
+## kubernetes类型的自动发现 路由创建示例
+
+- 服务、对应名称空间及endpoints信息展示
+```
+[root@ ~]# kubectl get pods -n test |grep test-app
+test-app-6f57f6fffb-gfblz                   1/1     Running            0          6d23h
+
+[root@ ~]# kubectl get endpoints -n test test-app
+NAME          ENDPOINTS             AGE
+test-app   10.223.216.201:8080   1d
+
+[root@ ~]# kubectl describe endpoints -n test test-app
+Name:         test-app
+Namespace:    test
+Labels:       app=test-app
+Annotations:  endpoints.kubernetes.io/last-change-trigger-time: 2022-06-02T19:07:21+08:00
+Subsets:
+  Addresses:          10.223.216.201
+  NotReadyAddresses:  <none>
+  Ports:
+    Name     Port  Protocol
+    ----     ----  --------
+    8080tcp  8080  TCP                        #注意此处的端口名称 创建路由时 service_name字段中需要添加
+
+Events:  <none>
+```
+
+- 通过apisix api创建自动发现类型为kubernetes的路由 示例如下:
+```
+curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f8sdfcx7ad84b625c8f1sdfagw32' -X PUT -i -d '

Review Comment:
   ```suggestion
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   ```



##########
docs/zh/latest/discovery/kubernetes.md:
##########
@@ -45,7 +45,7 @@ discovery:
       port: ${KUBERNETES_SERVICE_PORT}  #default ${KUBERNETES_SERVICE_PORT}
 
     client:
-      # serviceaccount token or token_file
+      # serviceaccount token or token_file token_file中应注意不要有换行符 请使用echo -n token > token_file 来生成此文件

Review Comment:
   ```suggestion
         # serviceaccount token or token_file token_file 中应注意不要有换行符 请使用 echo -n token > token_file 来生成此文件
   ```



##########
docs/zh/latest/discovery/kubernetes.md:
##########
@@ -147,6 +147,54 @@ nodes("default/plat-dev:3306") 调用会得到如下的返回值:
        },
    }
   ```
+## kubernetes类型的自动发现 路由创建示例
+
+- 服务、对应名称空间及endpoints信息展示
+```
+[root@ ~]# kubectl get pods -n test |grep test-app
+test-app-6f57f6fffb-gfblz                   1/1     Running            0          6d23h
+
+[root@ ~]# kubectl get endpoints -n test test-app
+NAME          ENDPOINTS             AGE
+test-app   10.223.216.201:8080   1d
+
+[root@ ~]# kubectl describe endpoints -n test test-app
+Name:         test-app
+Namespace:    test
+Labels:       app=test-app
+Annotations:  endpoints.kubernetes.io/last-change-trigger-time: 2022-06-02T19:07:21+08:00
+Subsets:
+  Addresses:          10.223.216.201
+  NotReadyAddresses:  <none>
+  Ports:
+    Name     Port  Protocol
+    ----     ----  --------
+    8080tcp  8080  TCP                        #注意此处的端口名称 创建路由时 service_name字段中需要添加
+
+Events:  <none>
+```
+
+- 通过apisix api创建自动发现类型为kubernetes的路由 示例如下:
+```
+curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f8sdfcx7ad84b625c8f1sdfagw32' -X PUT -i -d '

Review Comment:
   Please use the default Admin API Key.



-- 
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] github-actions[bot] commented on pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7232:
URL: https://github.com/apache/apisix/pull/7232#issuecomment-1214131303

   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
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] Maple521 commented on pull request #7232: docs: update kubernetes document

Posted by "Maple521 (via GitHub)" <gi...@apache.org>.
Maple521 commented on PR #7232:
URL: https://github.com/apache/apisix/pull/7232#issuecomment-1463347829

   I have met the same problem, but I still can't solve it according to the above plan.
   
   ![image](https://user-images.githubusercontent.com/30151992/224241629-b8f050c3-bae5-4ca8-bad6-25b1db7fa978.png)
   `
   discovery:
     kubernetes:
       service:
         schema: https
         host: "192.168.65.4"
         port: "6443"
       client:
         token: |-  
           eyJhbGciOixxxxxxxx
         #token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
       namespace_selector:
         equal: service-k8s-demo`
   
   my upstream service config is:
   `{
     "timeout": {
       "connect": 6,
       "send": 6,
       "read": 6
     },
     "type": "roundrobin",
     "scheme": "http",
     "discovery_type": "kubernetes",
     "pass_host": "pass",
     "name": "get service-provider service from K8s",
     "service_name": "service-k8s-demo/service-provider:tcp30000",
     "keepalive_pool": {
       "idle_timeout": 60,
       "requests": 1000,
       "size": 320
     }
   }`
   
   Then when I ask the Apisix gateway, it will report an error:
   `172.19.0.1 - - [10/Mar/2023:06:38:37 +0000] hongchenkezhan.com "GET /provider/provider-hello HTTP/1.1" 503 269 0.000 "-" "PostmanRuntime-ApipostRuntime/1.1.0" - - - "http://hongchenkezhan.com"
   2023/03/10 06:38:47 [error] 50#50: *53318 [lua] init.lua:486: handle_upstream(): failed to set upstream: no valid upstream node: nil, client: 172.19.0.1, server: _, request: "GET /provider/provider-hello HTTP/1.1", host: "hongchenkezhan.com"`
   
   ![image](https://user-images.githubusercontent.com/30151992/224242319-08d6af08-802e-4f20-a06c-fa48811201bc.png)
   
   I obtained the token through this command:
   `kubectl -n service-k8s-demo  exec -it service-provider-6d47bdd64-4zqhd -- cat /var/run/secrets/kubernetes.io/serviceaccount/token`
   
   This is the configuration of my serviceaccount. It has permissions:
   `apiVersion: v1
   kind: Namespace
   metadata:
     name: service-k8s-demo
     labels:
       name: service-k8s-demo
   
   ---
   
   apiVersion: v1
   kind: ServiceAccount
   metadata:
     name: service-k8s-demo
     namespace: service-k8s-demo
   
   ---
   
   kind: ClusterRole
   apiVersion: rbac.authorization.k8s.io/v1
   metadata:
     namespace: service-k8s-demo
     name: service-k8s-demo
   rules:
     - apiGroups:
       - ""
       resources:
       - services
       - configmaps
       - endpoints
       - nodes
       - pods
       - secrets
       - namespaces
       verbs:
       - get
       - list
       - watch
   
   ---
   
   apiVersion: rbac.authorization.k8s.io/v1
   kind: ClusterRoleBinding
   metadata:
     name: service-k8s-demo
     namespace: service-k8s-demo
   subjects:
   - kind: ServiceAccount
     name: service-k8s-demo
     namespace: service-k8s-demo
   roleRef:
     kind: ClusterRole
     name: service-k8s-demo
     apiGroup: rbac.authorization.k8s.io`
   


-- 
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] hf400159 commented on pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
hf400159 commented on PR #7232:
URL: https://github.com/apache/apisix/pull/7232#issuecomment-1153068136

   > hi, I have sent you a private message. 😄 
   
   


-- 
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] github-actions[bot] commented on pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7232:
URL: https://github.com/apache/apisix/pull/7232#issuecomment-1242930752

   This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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] tokers commented on a diff in pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7232:
URL: https://github.com/apache/apisix/pull/7232#discussion_r895118658


##########
docs/zh/latest/discovery/kubernetes.md:
##########
@@ -147,6 +147,54 @@ nodes("default/plat-dev:3306") 调用会得到如下的返回值:
        },
    }
   ```
+## kubernetes类型的自动发现 路由创建示例
+
+- 服务、对应名称空间及endpoints信息展示
+```
+[root@ ~]# kubectl get pods -n test |grep test-app

Review Comment:
   We may remove these leaded prompts. Just reserve the command itself.



##########
docs/zh/latest/discovery/kubernetes.md:
##########
@@ -147,6 +147,54 @@ nodes("default/plat-dev:3306") 调用会得到如下的返回值:
        },
    }
   ```
+## kubernetes类型的自动发现 路由创建示例

Review Comment:
   ```suggestion
   
   ## kubernetes 类型的自动发现 路由创建示例
   ```



##########
docs/zh/latest/discovery/kubernetes.md:
##########
@@ -45,7 +45,7 @@ discovery:
       port: ${KUBERNETES_SERVICE_PORT}  #default ${KUBERNETES_SERVICE_PORT}
 
     client:
-      # serviceaccount token or token_file
+      # serviceaccount token or token_file token_file中应注意不要有换行符 请使用echo -n token > token_file 来生成此文件

Review Comment:
   It's better to show the shell command in a code block.
   
   ```shell
   echo -n token > token_file
   ```



-- 
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] liangyawang commented on pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
liangyawang commented on PR #7232:
URL: https://github.com/apache/apisix/pull/7232#issuecomment-1152146120

   这个邮件很乱 您是让我修改哪部分的格式 咱们可否在slack交流
   
   > 2022年6月10日 下午4:43,feihan ***@***.***> 写道:
   > 
   > 
   > @hf400159 commented on this pull request.
   > 
   > Can you modify the format of this document? please refer: Chinese documentation style guide <https://apisix.apache.org/zh/docs/general/documentation-style-guide>.
   > 
   > In docs/zh/latest/discovery/kubernetes.md <https://github.com/apache/apisix/pull/7232#discussion_r894281950>:
   > 
   > > @@ -45,7 +45,7 @@ discovery:
   >        port: ${KUBERNETES_SERVICE_PORT}  #default ${KUBERNETES_SERVICE_PORT}
   >  
   >      client:
   > -      # serviceaccount token or token_file
   > +      # serviceaccount token or token_file token_file中应注意不要有换行符 请使用echo -n token > token_file 来生成此文件
   > ⬇️ Suggested change
   > -      # serviceaccount token or token_file token_file中应注意不要有换行符 请使用echo -n token > token_file 来生成此文件
   > +      # serviceaccount token or token_file token_file 中应注意不要有换行符 请使用 echo -n token > token_file 来生成此文件
   > In docs/zh/latest/discovery/kubernetes.md <https://github.com/apache/apisix/pull/7232#discussion_r894288435>:
   > 
   > > +Labels:       app=test-app
   > +Annotations:  endpoints.kubernetes.io/last-change-trigger-time: 2022-06-02T19:07:21+08:00
   > +Subsets:
   > +  Addresses:          10.223.216.201
   > +  NotReadyAddresses:  <none>
   > +  Ports:
   > +    Name     Port  Protocol
   > +    ----     ----  --------
   > +    8080tcp  8080  TCP                        #注意此处的端口名称 创建路由时 service_name字段中需要添加
   > +
   > +Events:  <none>
   > +```
   > +
   > +- 通过apisix api创建自动发现类型为kubernetes的路由 示例如下:
   > +```
   > +curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f8sdfcx7ad84b625c8f1sdfagw32' -X PUT -i -d '
   > ⬇️ Suggested change
   > -curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f8sdfcx7ad84b625c8f1sdfagw32' -X PUT -i -d '
   > +curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   > In docs/zh/latest/discovery/kubernetes.md <https://github.com/apache/apisix/pull/7232#discussion_r894298038>:
   > 
   > > +Labels:       app=test-app
   > +Annotations:  endpoints.kubernetes.io/last-change-trigger-time: 2022-06-02T19:07:21+08:00
   > +Subsets:
   > +  Addresses:          10.223.216.201
   > +  NotReadyAddresses:  <none>
   > +  Ports:
   > +    Name     Port  Protocol
   > +    ----     ----  --------
   > +    8080tcp  8080  TCP                        #注意此处的端口名称 创建路由时 service_name字段中需要添加
   > +
   > +Events:  <none>
   > +```
   > +
   > +- 通过apisix api创建自动发现类型为kubernetes的路由 示例如下:
   > +```
   > +curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f8sdfcx7ad84b625c8f1sdfagw32' -X PUT -i -d '
   > Please use the default Admin API Key.
   > 
   > —
   > Reply to this email directly, view it on GitHub <https://github.com/apache/apisix/pull/7232#pullrequestreview-1002426018>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKKWAISWULB772JZOD3SWS3VOL5ZXANCNFSM5YMZYMCA>.
   > You are receiving this because you authored the thread.
   > 
   
   


-- 
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] github-actions[bot] closed pull request #7232: docs: update kubernetes document

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #7232: docs: update kubernetes document
URL: https://github.com/apache/apisix/pull/7232


-- 
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