- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想部署在 kubernetes 服务上的后端服务使用带有路径/sso-dev/的入口进行访问,因为我已经在 kubernetes 容器上部署了我的服务,下面提到了部署、服务和入口 list ,但是虽然使用路径/sso-dev/访问入口负载均衡器 api 它抛出“响应 404(后端未找到),路径不存在的服务规则”错误
我需要帮助才能访问与 kubernetes 容器负载平衡 ip 一起正常工作的后端服务。
这是我的入口配置
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/backends: '{"k8s-be-30969--6d0e236a1c7d6409":"HEALTHY","k8s1-6d0e236a-default-sso-dev-service-80-849fdb46":"HEALTHY"}'
ingress.kubernetes.io/forwarding-rule: k8s2-fr-uwdva40x-default-my-ingress-h98d0sfl
ingress.kubernetes.io/target-proxy: k8s2-tp-uwdva40x-default-my-ingress-h98d0sfl
ingress.kubernetes.io/url-map: k8s2-um-uwdva40x-default-my-ingress-h98d0sfl
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"networking.k8s.io/v1","kind":"Ingress","metadata":{"annotations":{"nginx.ingress.kubernetes.io/backend-protocol":"HTTP","nginx.ingress.kubernetes.io/rewrite-target":"/"},"name":"my-ingress","namespace":"default"},"spec":{"rules":[{"http":{"paths":[{"backend":{"service":{"name":"sso-dev-service","port":{"number":80}}},"path":"/sso-dev/*","pathType":"ImplementationSpecific"}]}}]}}
nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/rewrite-target: /
creationTimestamp: "2022-06-22T12:30:49Z"
finalizers:
- networking.gke.io/ingress-finalizer-V2
generation: 1
managedFields:
- apiVersion: networking.k8s.io/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubectl.kubernetes.io/last-applied-configuration: {}
f:nginx.ingress.kubernetes.io/backend-protocol: {}
f:nginx.ingress.kubernetes.io/rewrite-target: {}
f:spec:
f:rules: {}
manager: kubectl-client-side-apply
operation: Update
time: "2022-06-22T12:30:49Z"
- apiVersion: networking.k8s.io/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
f:ingress.kubernetes.io/backends: {}
f:ingress.kubernetes.io/forwarding-rule: {}
f:ingress.kubernetes.io/target-proxy: {}
f:ingress.kubernetes.io/url-map: {}
f:finalizers:
.: {}
v:"networking.gke.io/ingress-finalizer-V2": {}
f:status:
f:loadBalancer:
f:ingress: {}
manager: glbc
operation: Update
subresource: status
time: "2022-06-22T12:32:13Z"
name: my-ingress
namespace: default
resourceVersion: "13073497"
uid: 253e067f-0711-4d24-a706-497692dae4d9
spec:
rules:
- http:
paths:
- backend:
service:
name: sso-dev-service
port:
number: 80
path: /sso-dev/*
pathType: ImplementationSpecific
status:
loadBalancer:
ingress:
- ip: 34.111.49.35
部署.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2022-06-22T08:52:11Z"
generation: 1
labels:
app: sso-dev
managedFields:
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:labels:
.: {}
f:app: {}
f:spec:
f:progressDeadlineSeconds: {}
f:replicas: {}
f:revisionHistoryLimit: {}
f:selector: {}
f:strategy:
f:rollingUpdate:
.: {}
f:maxSurge: {}
f:maxUnavailable: {}
f:type: {}
f:template:
f:metadata:
f:labels:
.: {}
f:app: {}
f:spec:
f:containers:
k:{"name":"cent-sha256-1"}:
.: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:dnsPolicy: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext: {}
f:terminationGracePeriodSeconds: {}
manager: GoogleCloudConsole
operation: Update
time: "2022-06-22T08:52:11Z"
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:deployment.kubernetes.io/revision: {}
f:status:
f:availableReplicas: {}
f:conditions:
.: {}
k:{"type":"Available"}:
.: {}
f:lastTransitionTime: {}
f:lastUpdateTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
k:{"type":"Progressing"}:
.: {}
f:lastTransitionTime: {}
f:lastUpdateTime: {}
f:message: {}
f:reason: {}
f:status: {}
f:type: {}
f:observedGeneration: {}
f:readyReplicas: {}
f:replicas: {}
f:updatedReplicas: {}
manager: kube-controller-manager
operation: Update
subresource: status
time: "2022-06-22T11:51:22Z"
name: sso-dev
namespace: default
resourceVersion: "13051665"
uid: c8732885-b7d8-450c-86c4-19769638eb2a
spec:
progressDeadlineSeconds: 600
replicas: 3
revisionHistoryLimit: 10
selector:
matchLabels:
app: sso-dev
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: sso-dev
spec:
containers:
- image: us-east4-docker.pkg.dev/centegycloud-351515/sso/cent@sha256:64b50553219db358945bf3cd6eb865dd47d0d45664464a9c334602c438bbaed9
imagePullPolicy: IfNotPresent
name: cent-sha256-1
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 3
conditions:
- lastTransitionTime: "2022-06-22T08:52:11Z"
lastUpdateTime: "2022-06-22T08:52:25Z"
message: ReplicaSet "sso-dev-8566f4bc55" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
- lastTransitionTime: "2022-06-22T11:51:22Z"
lastUpdateTime: "2022-06-22T11:51:22Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
observedGeneration: 1
readyReplicas: 3
replicas: 3
updatedReplicas: 3
服务.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/neg: '{"ingress":true}'
cloud.google.com/neg-status: '{"network_endpoint_groups":{"80":"k8s1-6d0e236a-default-sso-dev-service-80-849fdb46"},"zones":["us-central1-c"]}'
creationTimestamp: "2022-06-22T08:53:32Z"
finalizers:
- service.kubernetes.io/load-balancer-cleanup
labels:
app: sso-dev
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:labels:
.: {}
f:app: {}
f:spec:
f:allocateLoadBalancerNodePorts: {}
f:externalTrafficPolicy: {}
f:internalTrafficPolicy: {}
f:ports:
.: {}
k:{"port":80,"protocol":"TCP"}:
.: {}
f:port: {}
f:protocol: {}
f:targetPort: {}
f:selector: {}
f:sessionAffinity: {}
f:type: {}
manager: GoogleCloudConsole
operation: Update
time: "2022-06-22T08:53:32Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:finalizers:
.: {}
v:"service.kubernetes.io/load-balancer-cleanup": {}
f:status:
f:loadBalancer:
f:ingress: {}
manager: kube-controller-manager
operation: Update
subresource: status
time: "2022-06-22T08:53:58Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
f:cloud.google.com/neg-status: {}
manager: glbc
operation: Update
subresource: status
time: "2022-06-22T12:30:49Z"
name: sso-dev-service
namespace: default
resourceVersion: "13071362"
uid: 03b0cbe6-1ed8-4441-b2c5-93ae5803a582
spec:
allocateLoadBalancerNodePorts: true
clusterIP: 10.32.6.103
clusterIPs:
- 10.32.6.103
externalTrafficPolicy: Cluster
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- nodePort: 30584
port: 80
protocol: TCP
targetPort: 8080
selector:
app: sso-dev
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer:
ingress:
- ip: 104.197.93.226
最佳答案
您需要在入口中将 pathType 更改为 Prefix,如下所示:
pathType: Prefix
因为我注意到您正在使用 pathType: ImplementationSpecific
。使用此值,匹配取决于 IngressClass
,因此我认为对于您的情况,pathType Prefix
应该更有帮助。此外,您可以在此 link 中找到有关 kubernetes 支持的入口路径类型的更多信息。 .
关于kubernetes - 使用 Ingress Google Cloud 获取 "response 404 (backend NotFound), service rules for the path non-existent",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72715939/
我在 GCP 上使用 k8s。需要设置入口来设置 TLS 连接,所以我为我的应用程序设置了入口,它有效!!! 顺便说一句,什么是入口 Controller ,如 Nginx Ingress Contr
我有一个响应 / 的后端服务,但我希望它在入口路由 myhost.com/overview 上运行。无论我尝试哪种配置,traefik 都不会删除路径 /overview - 我可以看到后端获取 /o
我正在尝试添加多个应该共享同一主机的 Ingress。 一个 Ingress 应该处理对 www.example.de/some 的请求,一个 Ingress 应该处理所有其他请求。 这是 Ingre
我正在尝试设置入口负载平衡器。 基本上,我有一个具有多个路径的后端服务。 假设我的后端 NodePort 服务名称是 hello-app。与此服务关联的 pod 公开多个路径,如/foo 和/bar。
我已经按照文档中的说明设置了 Nginx Controller https://docs.nginx.com/nginx-ingress-controller/installation/install
在 kubernetes 中,如果我在下面有一个入口资源,它如何知道要使用哪种类型的入口 Controller 或哪个入口 Controller (如果我有多个)? ” apiVersion: ext
如何为 ingress-nginx 中的所有主机使用自定义通配符 TLS 证书? 我使用 ingress-nginx 作为入口 Controller 。它是使用 Helm 图表安装的: helm re
有没有办法在 Kong-Ingress-Controller 中设置通配符证书以在每个 Ingress 中使用? 我从图表安装了Kong: $ helm repo add kong https://c
GKE 入口:https://cloud.google.com/kubernetes-engine/docs/concepts/ingress Nginx 入口:https://kubernetes.
此配置适用于其他集群,但不适用于我部署的最后一个集群。 我的 RBAC 配置存在某种问题。 kubectl get pods -n ingress-controller NAME
我有一个服务在 NodePort 服务上运行。我如何使用入口访问多个服务。 部署.yml apiVersion: apps/v1 kind: Deployment metadata: name:
我正在尝试在 GKE 中创建静态内部入口。似乎我们没有直接的方法。我遵循了 How to set static internal IP to the GKE internal Ingress 之后的解
我正在尝试让 GKE 入口要求像这样的基本身份验证 example from github. 入口工作正常。它路由到服务。但是身份验证不起作用。允许所有流量直接通过。 GKE 还没有推出这个功能吗?我
我目前正在将 IT 环境从 Nginx Ingress Gateway 迁移到 Kubernetes 上的 IstIO Ingress Gateway。 我需要迁移以下 Nginx 注释: nginx
我想在我的自托管系统上构建一个 gitlab + kubernetes 小 gitops。但是当我尝试从 gitlab kubernetes 部分安装 nginx ingress 时,出现此错误:Se
I'm struggling to set a global (on ingress controller scope) SSL/HTTPS redirection. It works fine
I'm struggling to set a global (on ingress controller scope) SSL/HTTPS redirection. It works fine
我正在尝试使用 Kong 插件进行 k8s 入口自定义。具体来说,我正在使用 Kong 入口 Controller 和“request-transformer-advanced”插件(引用: http
我使用 Kubespray 部署了一个裸机集群,并启用了 kubernetes 1.22.2、MetalLB 和 ingress-nginx。在设置 ingressClassName: nginx 时
我正在使用 NextJS,我需要它知道它何时在服务器或浏览器上发出请求。要在服务器端做,因为我是在微服务架构中构建的,我需要获取服务的服务名称和命名空间来完成这样的 url http://SERVIC
我是一名优秀的程序员,十分优秀!