我无法应用入口配置。
我需要通过它的 DNS 访问 jupyter-lab 服务
它部署到 3 节点裸机 k8s 集群
- node1.local(主)
- node2.local(工人)
- node3.local(工人)
Flannel 安装为网络控制器
我已经为这样的裸机安装了 nginx 入口
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/baremetal/deploy.yaml
部署时,jupyter-lab pod 位于 node2 上,并且NodePort服务从http://node2.local:30004正确响应(见下文)
我期待 ingress-nginx 控制器将通过其 DNS 名称公开ClusterIP服务......这就是我所需要的,这是错误的吗?
这是 CIP 服务,用对称端口定义8888
尽可能简单(有错吗?)
---
apiVersion: v1
kind: Service
metadata:
name: jupyter-lab-cip
namespace: default
spec:
type: ClusterIP
ports:
- port: 8888
targetPort: 8888
selector:
app: jupyter-lab
DNS 名称
jupyter-lab.local
解析为集群的 IP 地址范围,但超时且无响应。Failed to connect to jupyter-lab.local port 80: No route to host
firewall-cmd --list-all
显示每个节点上都打开了 80 端口
这是 http 进入集群(任何节点)端口 80 的入口定义。(错了吗?)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jupyter-lab-ingress
annotations:
# nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io: /
spec:
rules:
- host: jupyter-lab.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: jupyter-lab-cip
port:
number: 80
这是部署
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter-lab-dpt
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: jupyter-lab
template:
metadata:
labels:
app: jupyter-lab
spec:
volumes:
- name: jupyter-lab-home
persistentVolumeClaim:
claimName: jupyter-lab-pvc
containers:
- name: jupyter-lab
image: docker.io/jupyter/tensorflow-notebook
ports:
- containerPort: 8888
volumeMounts:
- name: jupyter-lab-home
mountPath: /var/jupyter-lab_home
env:
- name: "JUPYTER_ENABLE_LAB"
value: "yes"
我可以通过其 NodePort http://node2:30004 使用以下定义成功访问 jupyter-lab:
---
apiVersion: v1
kind: Service
metadata:
name: jupyter-lab-nodeport
namespace: default
spec:
type: NodePort
ports:
- port: 10003
targetPort: 8888
nodePort: 30004
selector:
app: jupyter-lab
我怎样才能在http://jupyter-lab.local进入我的 jupyter-lab ???
- 命令
kubectl get endpoints -n ingress-nginx ingress-nginx-controller-admission
返回:
ingress-nginx-controller-admission 10.244.2.4:8443 15m
我是否错误配置了端口?
我的“选择器:应用程序名称”定义错误吗?
我错过了一部分吗
我怎样才能调试发生了什么?
其他详情
应用入口时出现此错误
kubectl apply -f default-ingress.yml
Error from server (InternalError): error when creating "minnimal-ingress.yml": Internal error occurred: failed calling webhook "validate.nginx.ingress.kubernetes.io": Post "https://ingress-nginx-contr oller-admission.ingress-nginx.svc:443/networking/v1beta1/ingresses?timeout=10s": context deadline exceeded
此命令
kubectl delete validatingwebhookconfigurations --all-namespaces
删除了验证 webhook ...这样做有错吗?我已经在集群中的每个节点上打开了端口 8443