在Windows 10的minikube集群中,我正在运行一个简单的pod,其中包含来自本地镜像注册表的镜像。我还运行了一个简单的nodeport服务。当我尝试使用:30080从浏览器访问容器时,它是可用的。
但是,现在我想设置一个入口控制器,因为我想设置一个域,而不是使用IP访问它。入口适用于一些简单的东西,如基本的nginx pod,但不适用于我正在尝试使用的这个pod。我之前在docker-compose中使用了jwilder/nginx-proxy,它有一些conf文件需要附加到conf.d目录中。然而,由于我要迁移到Kubernetes,我想完全省略conf文件和反向代理镜像。
现在,在主机fie更新之后,可以通过curl到达该域,该域也是可also通的,然而,它根本无法在浏览器上到达。
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: api
name: api
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: api
strategy:
type: RollingUpdate
template:
metadata:
labels:
io.kompose.service: api
spec:
containers:
- env:
- name: DEV_PORT
value: "80"
image: localhost:5000/api:2.3
imagePullPolicy: "IfNotPresent"
name: api
resources: {}
restartPolicy: Always
serviceAccountName: ""
status: {}Service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: C:\Users\***kompose.exe
convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: api
name: api
spec:
selector:
io.kompose.service: api
type: NodePort
ports:
- name: "http"
port: 80
targetPort: 80
nodePort: 30080Ingress.yaml
apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
name: tls-ingress
spec:
tls:
- secretName: oaky-tls
hosts:
- api.localhost
rules:
- host: api.localhost
http:
paths:
- path: /
backend:
serviceName: api
servicePort: 80我已经检查过了,TLS的秘密是可用的,我不理解这里的问题,真的希望能得到一些帮助。
发布于 2020-08-04 16:38:26
解决方法: Chrome忽略了etc主机文件,所以我做了以下操作:
kubernetes.io/ingress.class: nginx
。
nginx.ingress.kubernetes.io/ssl-redirect:"true"
https://stackoverflow.com/questions/63149039
复制相似问题