我的部署和其他用于 consul 中示例应用程序的 yaml 文件:关联 路由没有发生。
有人可以检查一下并建议需要修复什么吗?
流量根本没有进入应用程序。
我安装 consul 的步骤如下:
我已经使用此链接在 kubernetes(docker 桌面)上安装了 consul。
git clone https://github.com/hashicorp/learn-consul-kubernetes.git
cd learn-consul-kubernetes/service-mesh/deploy
helm repo add hashicorp https://helm.releases.hashicorp.com
helm repo update
helm install -f config.yaml consul hashicorp/consul --version "0.31.1"
配置文件位于 repo 文件夹中:learn-consul-kubernetes/service-mesh/deploy
配置.yaml
global:
name: consul
datacenter: dc1
image: hashicorp/consul:1.9.7
imageEnvoy: envoyproxy/envoy:v1.16.4
metrics:
enabled: true
enableAgentMetrics: true
server:
replicas: 1
ui:
enabled: true
connectInject:
enabled: true
default: true
controller:
enabled: true
prometheus:
enabled: true
grafana:
enabled: true
并且 Pod 创建了:
kubectl get pods --selector app=consul
PS D:\consul\learn-consul-kubernetes\service-mesh\deploy> kubectl get pods --selector app=consul
NAME READY STATUS RESTARTS AGE
consul-6lf6k 1/1 Running 0 4h44m
consul-connect-injector-webhook-deployment-86759499c6-st7jj 1/1 Running 0 4h44m
consul-controller-5788b8f6c7-z4vmt 1/1 Running 0 4h44m
consul-server-0 1/1 Running 0 4h44m
consul-webhook-cert-manager-5745cbb9d-7qft2 1/1 Running 0 4h44m
访问这个 consul-ui:
kubectl port-forward service/consul-ui 18500:80 --address 0.0.0.0
并能够访问:http://localhost:18500/
领事服务器成员:
PS D:\consul\learn-consul-kubernetes\service-mesh> kubectl exec -it consul-server-0 -- consul members
Node Address Status Type Build Protocol DC Segment
consul-server-0 10.1.0.13:8301 alive server 1.9.7 2 dc1 <all>
docker-desktop 10.1.0.10:8301 alive client 1.9.7 2 dc1 <default>
在网络中应用零信任:
kubectl apply -f "D:\consul\learn-consul-kubernetes\service-mesh\zero-trust-network\deny-all.yaml"
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceIntentions
metadata:
name: deny-all
spec:
destination:
name: '*'
sources:
- name: '*'
action: deny
使用以下方式访问 consul-ui:
kubectl port-forward service/consul-ui 18500:80 --address 0.0.0.0
http://localhost:18500/ui/dc1/intentions 迄今为止的意图:
现在,零意图已创建,我将部署一个示例应用程序。
PS D:\consul\learn-consul-kubernetes\service-mesh\onlytext\consul-testing\static-app2>
kubectl apply -f .
ingressgateway.consul.hashicorp.com/ingress-gateway created
servicedefaults.consul.hashicorp.com/static created
serviceintentions.consul.hashicorp.com/static created
service/static-server2 created
serviceaccount/static created
deployment.apps/static-deployment created
现在,已部署的应用程序未与 Ingress 连接。您能建议如何修复此问题吗?