【发布时间】:2018-12-11 15:08:08
【问题描述】:
我正在通过 kubernetes 创建一个 nexus repo。通过浏览,我发现了这个站点 (https://blog.sonatype.com/kubernetes-recipe-sonatype-nexus-3-as-a-private-docker-registry),我能够创建服务和部署以及 pod 以及创建的所有内容,而不会出现问题。但是我打不开。
这是我的 nexus.yaml 文件
apiVersion: v1
kind: Namespace
metadata:
name: nexus
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nexusvolume-local
namespace: nexus
labels:
app: nexus
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nexus
namespace: nexus
spec:
replicas: 1
template:
metadata:
labels:
app: nexus
spec:
containers:
- image: sonatype/nexus3
imagePullPolicy: Always
name: nexus
ports:
- containerPort: 8081
- containerPort: 5000
volumeMounts:
- mountPath: /nexus-data
name: nexus-data-volume
volumes:
- name: nexus-data-volume
persistentVolumeClaim:
claimName: nexusvolume-local
---
apiVersion: v1
kind: Service
metadata:
name: nexus-service
namespace: nexus
spec:
ports:
- port: 80
targetPort: 8081
protocol: TCP
name: http
- port: 5000
targetPort: 5000
protocol: TCP
name: docker
selector:
app: nexus
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nexus-ingress
namespace: nexus
annotations:
ingress.kubernetes.io/proxy-body-size: 100m
kubernetes.io/tls-acme: "true"
kubernetes.io/ingress.class: "nginx"
spec:
tls:
- hosts:
# CHANGE ME
- docker.testnexusurl.com
- nexus.testnexusurl.com
secretName: nexus-tls
rules:
# CHANGE ME
- host: nexus.testnexusurl.com
http:
paths:
- path: /
backend:
serviceName: nexus-service
servicePort: 80
# CHANGE ME
- host: docker.testnexusurl.com
http:
paths:
- path: /
backend:
serviceName: nexus-service
servicePort: 5000
当我给
kubectl describe service nexus-service -n nexus
Name: nexus-service
Namespace: nexus
Labels: <none>
Annotations: <none>
Selector: app=nexus
Type: ClusterIP
IP: 10.111.212.3
Port: http 80/TCP
TargetPort: 8081/TCP
Endpoints: 172.17.0.11:8081
Port: docker 5000/TCP
TargetPort: 5000/TCP
Endpoints: 172.17.0.11:5000
Session Affinity: None
Events: <none>
我尝试通过提供端口并打开,但我得到了一个可以到达的错误。
有人可以帮我吗??? 提前致谢。
【问题讨论】:
-
“我尝试提供端口并打开,但我得到了一个可以到达的错误。”大概您的意思是“无法到达”? 编辑:我第一次没有看到
Ingress,但我的问题是:“给出端口但无法到达”到底是什么意思? -
我的意思是当我尝试使用 minikube IP 地址和端口号打开端口时。表示无法连接或服务器响应时间过长。 minikube IP 地址意味着当我给 minikube ip 时,我将获得 minikube 的 IP 地址。
-
抱歉,由于无法访问网站,所以无法连接。
-
你继续说“端口号”,好像我们知道那是什么意思;请尝试帮助我们来帮助您——含糊其辞无济于事。如果您使用的是 minikube,您将需要找到暴露您的入口控制器的
NodePort,因为 that 是您应该将请求发送到的端口。此外,除非您的 DNS 名称指向您的 minikube IP,否则入口控制器使用的虚拟主机将无法正常工作。您可以使用 curl 进行尝试,或者编辑您的/etc/hosts我猜,但它不会“正常工作” -
对不起,我所说的端口号是端点 172.17.0.11:8081。
标签: kubernetes nexus kubernetes-ingress persistent-volumes persistent-volume-claims