我使用 helm 部署了 pulsar,但没有激活 tls。现在我想使用 nginx 入口来公开它,而不是第一次使用 tls。它不起作用,我在客户端得到这个:
Got exception TooLongFrameException : Adjusted frame length exceeds 5253120: 1213486164 - discarded
Run Code Online (Sandbox Code Playgroud)
是否缺少特定注释?
第二次,我想使用 ssl 证书以安全的方式公开它。Ingress 可以与 pulsar+ssl 协议一起使用吗?我还需要具体注释吗?
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: pulsar
namespace: default
spec:
rules:
- host: pulsar.myurl.com
http:
paths:
- backend:
serviceName: pulsar-proxy
servicePort: 6650
tls:
- hosts:
- pulsar.myurl.com
secretName: pulsar.myurl.com.crt
Run Code Online (Sandbox Code Playgroud) 我已经创建了规则。现在我在 Ingress 描述中看到这条消息:
Error during GC: error running load balancer garbage collection routine:
googleapi: Error 400: Invalid value for field 'forwardingRule': 'k8s2-fr-nbxe481u-default-kaf.XXX-XXXX.XX-3r69b1ge'. Must be a match of regex '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?|[1-9][0-9]{0,19}', invalid
Run Code Online (Sandbox Code Playgroud)
尝试在 GKE Web 控制台中删除此选项后,没有任何反应。
kubectl挂在:
kubectl delete ingress this_ingress
networking google-cloud-platform google-kubernetes-engine nginx-ingress
我遇到了一个相当奇怪的问题,并且已经被困在这个问题上两天了。我有一个运行 nginx-ingress 和 cert-manager 的 kubernetes 集群。一切似乎都工作正常,但当通过 HTTPS 访问我的网站时,它给出以下错误(在 chromium Edge 中):
NET::ERR_CERT_AUTHORITY_INVALID
如果我继续,它会正常加载网站,但没有证书。
证书已正确给出,秘密已创建,任何地方都没有错误。
我的入口资源中有以下注释:
kubernetes.io/ingress.class: "nginx"
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: "letsencrypt-production"
ingress.kubernetes.io/ssl-redirect: "true"
Run Code Online (Sandbox Code Playgroud)
我的集群发行者:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-production
spec:
acme:
# The ACME production api URL
server: https://acme-staging-v02.api.letsencrypt.org/directory
# Email address used for ACME registration
email: *********
# Name of a secret used to store the ACME account private key
privateKeySecretRef:
name: letsencrypt-production
# Enable the HTTP-01 challenge provider
solvers:
- http01:
ingress:
class: nginx
Run Code Online (Sandbox Code Playgroud)
证书资源返回: …
我正在尝试将静态网站部署到使用官方 Nginx Ingress 控制器的 Kubernetes 集群。该网站的文件夹结构看起来有点像这样:
\n/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 about\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 casestudy\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 data-and-analytics\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 workflow-automation\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 contact\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 css\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 font-awesome.min.css\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 fonts\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 slick.eot\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 slick.svg\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 slick.ttf\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 slick.woff\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 footer.css\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 layout.css\n...\nRun Code Online (Sandbox Code Playgroud)\n我的入口定义如下所示:
\n/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 about\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 casestudy\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 data-and-analytics\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 workflow-automation\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 contact\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 css\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 font-awesome.min.css\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 fonts\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 slick.eot\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 slick.svg\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 slick.ttf\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x82\xc2\xa0\xc2\xa0 …Run Code Online (Sandbox Code Playgroud) 我有一个 kubernetes 类入口nginx和两个负载均衡器。在 GKE v1.17 上运行。
入口 yaml 示例:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: my-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
kubernetes.io/ingress.class: "nginx"
# Enable client certificate authentication
nginx.ingress.kubernetes.io/auth-tls-verify-client: "on"
# Create the secret containing the trusted ca certificates
nginx.ingress.kubernetes.io/auth-tls-secret: "production/client-cert-secret"
# Specify the verification depth in the client certificates chain
nginx.ingress.kubernetes.io/auth-tls-verify-depth: "1"
# Automatically redirect http to https
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
# Use regex in paths
nginx.ingress.kubernetes.io/use-regex: "true"
# Allow larger request body
nginx.ingress.kubernetes.io/proxy-body-size: 30m
# For notifications …Run Code Online (Sandbox Code Playgroud) 我有一个 EKS 集群,以及一个基于 Webflow 构建(并托管)的单独网站。
集群在后面cluster.com,网站在后面website.webflow.io
我想实现的是代理cluster.com/website请求website.webflow.io
根据我的研究,这个问题可以通过ExternalName 服务来解决。不幸的是,它没有为我解决这个问题,它正在尝试在集群内进行 DNS 查找。我还尝试了端点的各种其他配置。在我尝试过的所有内容中,ExternalName 似乎是最有前途的,这就是我附加下面的配置的原因。
我的配置如下:
---
kind: Service
apiVersion: v1
metadata:
namespace: development
name: external-service
spec:
type: ExternalName
externalName: website.webflow.io
ports:
- port: 443
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: development
name: external-ingress
annotations:
ingress.kubernetes.io/preserve-host: "false"
ingress.kubernetes.io/secure-backends: "true"
ingress.kubernetes.io/upstream-vhost: "website.webflow.io"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/server-snippet: |
proxy_ssl_name website.webflow.io;
proxy_ssl_server_name on;
spec:
rules:
- host: cluster.com
http:
paths:
- path: /website
backend:
serviceName: external-service
servicePort: 443
Run Code Online (Sandbox Code Playgroud)
有没有直接的方法来实现这一目标?配置中有哪些突出的错误?
我已经设置了一个k8s集群(目前1个裸机节点,既是master又是worker)。我还按照此处所述设置了 Nginx 入口控制器: https: //docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/以下是具体步骤:
kubectl apply -f common/ns-and-sa.yaml https://github.com/nginxinc/kubernetes-ingress/blob/release-1.11/deployments/common/ns-and-sa.yaml(无修改)kubectl apply -f rbac/rbac.yaml https://github.com/nginxinc/kubernetes-ingress/blob/release-1.11/deployments/rbac/rbac.yaml(无修改)kubectl apply -f common/default-server-secret.yaml https://github.com/nginxinc/kubernetes-ingress/blob/release-1.11/deployments/common/default-server-secret.yaml(无修改)kubectl apply -f common/nginx-config.yaml https://github.com/nginxinc/kubernetes-ingress/blob/release-1.11/deployments/common/nginx-config.yaml修改文件:kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
namespace: nginx-ingress
data:
ignore-invalid-headers: "false"
use-forwarded-headers: "true"
forwarded-for-header: "CF-Connecting-IP"
proxy-real-ip-cidr: "...IPs go here..."
Run Code Online (Sandbox Code Playgroud)
kubectl apply -f common/ingress-class.yaml https://github.com/nginxinc/kubernetes-ingress/blob/release-1.11/deployments/common/ingress-class.yaml修改后的文件:apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
name: nginx
annotations:
ingressclass.kubernetes.io/is-default-class: "true"
spec:
controller: nginx.org/ingress-controller
Run Code Online (Sandbox Code Playgroud)
kubectl apply -f common/crds/k8s.nginx.org_virtualservers.yaml
kubectl apply -f common/crds/k8s.nginx.org_virtualserverroutes.yaml
kubectl apply …Run Code Online (Sandbox Code Playgroud) 有人可以帮忙发现ingress-2入口规则的问题吗?为什么ingress-1有效与ingress-2无效。
我的设置描述,我有两个部署:
第一次部署是nginx
第二次部署是httpd
这两个部署均通过分别名为和 的ClusterIP服务公开。所有这些都适合服务。但是,在为这些服务设置入口时,我无法使用(如 中所述)设置入口。但是,当我使用时,一切正常。nginx-svchttpd-svcendpointshostingress-2ingress-1
// 我的主机文件用于名称解析
grep myapp.com /etc/hosts
127.0.0.1 myapp.com
Run Code Online (Sandbox Code Playgroud)
// 部署详细信息
kubectl get deployments.apps
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 3/3 3 3 29m
httpd 3/3 3 3 29m
Run Code Online (Sandbox Code Playgroud)
// 服务详情
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 7h48m
nginx-svc ClusterIP 10.152.183.233 <none> 80/TCP 28m
httpd-svc ClusterIP 10.152.183.58 <none> 80/TCP 27m
Run Code Online (Sandbox Code Playgroud)
// …
刚刚将我的 docker 映像部署到 Azure AKS 并创建了 nginx 入口控制器。我的图像具有 SSL 证书并自行处理 SSL。因此,我需要一条通往容器的直通路由。
当我导航到https://just-poc.live时 ,著名的 nginx 502 网关显示如下;
显然,nginx 找不到发送 https 流量的路由。
我应该怎么做才能让 nginx 控制器将流量路由到我的socket-poc部署?
nginx 入口控制器
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: hello-world-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /(.*)
pathType: Prefix
backend:
service:
name: socket-poc
port:
number: 8081
Run Code Online (Sandbox Code Playgroud)
部署.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: socket-poc
spec:
replicas: 1
selector:
matchLabels:
app: socket-poc
template:
metadata:
labels: …Run Code Online (Sandbox Code Playgroud) 我有一个全新的(非常空的)AKS 集群。我想使用 helm 在不同的命名空间和不同的入口类中安装 nginx 入口控制器的两个实例。
我从第一个开始:
helm install ingress1 ingress-nginx/ingress-nginx --namespace namespace1 --set controller.ingressClass=class1
NAME: ingress1
LAST DEPLOYED: Fri Sep 24 20:46:28 2021
NAMESPACE: namespace1
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
Run Code Online (Sandbox Code Playgroud)
都好
现在我选择第二个:
helm install ingress2 ingress-nginx/ingress-nginx --namespace namespace2 --set controller.ingressClass=class2
Error: rendered manifests contain a resource that already exists. Unable to continue with install: IngressClass "nginx" in …Run Code Online (Sandbox Code Playgroud) nginx-ingress ×10
kubernetes ×8
nginx ×4
ssl ×2
amazon-eks ×1
cert-manager ×1
helm3 ×1
microk8s ×1
networking ×1