gpt4 book ai didi

kubernetes - curl : (7) Failed to connect to 192. 168.99.100 端口 30790:连接被拒绝

转载 作者:行者123 更新时间:2023-12-02 12:34:40 28 4
gpt4 key购买 nike

我正在编写有关创建 Kubernetes 服务以指向大使部署的教程。

教程:https://www.bogotobogo.com/DevOps/Docker/Docker-Envoy-Ambassador-API-Gateway-for-Kubernetes.php

在运行命令时

curl $(minikube service --url ambassador)/httpbin/ip

我收到错误
curl: (7) Failed to connect to 192.168.99.100 port 30790: Connection refused
curl: (3) <url> malformed

我实际上可以消除错误
curl: (3) <url> malformed

通过运行
minikube service --url ambassador
http://192.168.99.100:30790

进而
curl http://192.168.99.100:30790/httpbin/ip

我已经尝试过这个答案 curl: (7) Failed to connect to 192.168.99.100 port 31591: Connection refused这个答案中提到的步骤也已经在博客中,但它没有用。

这是来自博客的代码,用于 Ambassador-svc.yaml
---
apiVersion: v1
kind: Service
metadata:
labels:
service: ambassador
name: ambassador
annotations:
getambassador.io/config: |
---
apiVersion: ambassador/v0
kind: Mapping
name: httpbin_mapping
prefix: /httpbin/
service: httpbin.org:80
host_rewrite: httpbin.org
spec:
type: LoadBalancer
ports:
- name: ambassador
port: 80
targetPort: 80
selector:
service: ambassador

这可能是与VM相关的问题吗?

另外,我尝试在 this 上工作首先教程,但不幸的是,得到了同样的错误。

让我知道我这边是否还有其他需要。

编辑:

1.正如评论中所问的,这里的输出是
kubectl get pods --namespace=kube-system
NAME                               READY   STATUS    RESTARTS   AGE
coredns-fb8b8dccf-qkxwm 1/1 Running 0 5h16m
coredns-fb8b8dccf-rrn4f 1/1 Running 0 5h16m
etcd-minikube 1/1 Running 0 5h15m
kube-addon-manager-minikube 1/1 Running 4 5h15m
kube-apiserver-minikube 1/1 Running 0 5h15m
kube-controller-manager-minikube 1/1 Running 0 3h17m
kube-proxy-wfbxs 1/1 Running 0 5h16m
kube-scheduler-minikube 1/1 Running 0 5h15m
storage-provisioner 1/1 Running 0 5h16m

跑完之后
kubectl apply -f https://docs.projectcalico.org/v3.7/manifests/calico.yaml
NAME                                       READY   STATUS    RESTARTS   AGE
calico-kube-controllers-78f8f67c4d-zqtl2 1/1 Running 0 65s
calico-node-27lcq 1/1 Running 0 65s
coredns-fb8b8dccf-qkxwm 1/1 Running 2 22h
coredns-fb8b8dccf-rrn4f 1/1 Running 2 22h
etcd-minikube 1/1 Running 1 22h
kube-addon-manager-minikube 1/1 Running 5 22h
kube-apiserver-minikube 1/1 Running 1 22h
kube-controller-manager-minikube 1/1 Running 0 8m27s
kube-proxy-wfbxs 1/1 Running 1 22h
kube-scheduler-minikube 1/1 Running 1 22h
storage-provisioner 1/1 Running 2 22h

最佳答案

kubectl 获取 pod --namespace=kube-system 应该有网络服务 pods
因此,您尚未设置用于 DNS 的网络策略。
尝试使用网络策略 Calico
通过使用命令
kubectl 应用 -f https://docs.projectcalico.org/v3.7/manifests/calico.yaml
立即查看 kubectl 获取 pod --namespace=kube-system
你应该得到这样的输出: -

NAMESPACE    NAME                                       READY  STATUS   RESTARTS  AGE
kube-system calico-kube-controllers-6ff88bf6d4-tgtzb 1/1 Running 0 2m45s
kube-system calico-node-24h85 1/1 Running 0 2m43s
kube-system coredns-846jhw23g9-9af73 1/1 Running 0 4m5s
kube-system coredns-846jhw23g9-hmswk 1/1 Running 0 4m5s
kube-system etcd-jbaker-1 1/1 Running 0 6m22s
kube-system kube-apiserver-jbaker-1 1/1 Running 0 6m12s
kube-system kube-controller-manager-jbaker-1 1/1 Running 0 6m16s
kube-system kube-proxy-8fzp2 1/1 Running 0 5m16s
kube-system kube-scheduler-jbaker-1 1/1 Running 0 5m41s

关于kubernetes - curl : (7) Failed to connect to 192. 168.99.100 端口 30790:连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56631385/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com