zhixiongdu027 commented on a change in pull request #4880: URL: https://github.com/apache/apisix/pull/4880#discussion_r810438684
########## File path: docs/zh/latest/discovery/kubernetes.md ########## @@ -0,0 +1,106 @@ +<!-- +# +# 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. +# +--> + +# 基于 Kubernetes 的服务发现 + +Kubernetes 服务发现插件以 ListWatch 方式监听 Kubernetes 集群的 的 v1.endpoints 的实时变化, +并将其值存储在 ngx.shared.DICT 中, 同时遵循 APISix Discovery 规范提供对外查询接口 + +# Kubernetes 服务发现插件的配置 + +Kubernetes 服务发现的样例配置如下: + +```yaml +discovery: + kubernetes: + service: + # kubernetes apiserver schema, options [ http | https ] + schema: https #default https + + # kubernetes apiserver host, options [ ipv4 | ipv6 | domain | env variable] + host: 10.0.8.95 #default ${KUBERNETES_SERVICE_HOST} Review comment: We may have two operating environments: Inside the Pod: Both the apiserver host and apiserver port values are stored via environment variables. Therefore, our configuration items must support the reference environment variable value, and the user needs to recognize the referenced environment variable value at a glance. ${} is a good form Outside the Pod: The apiserver host and apiserver port values are manually input by the user. We need a specific format to distinguish whether the value entered by the user is a domain name or an environment variable, ${} is also a good form If we have next config: ```yaml kubernetes: service: host: kubernets.default ``` How can we tell if "kubernets.default" is a constant or a domain name? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
