部署的端口没有在nexus中的kubernetes中公开




我正在通过kubernetes创建一个nexus repo。我偶然发现了这个网站(https://blog.sonatype.com/kubernetes-recipe-sonatype-nexus-3-as-a-private-docker-registry)我能够在没有问题的情况下创建服务和部署以及pod和everthing。但我没能打开它。

这是我的下一个.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描述服务nexus服务-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>

我试着打开端口,但我遇到了一个可以到达的错误。

有人能帮我吗???提前谢谢。

查看了上面的yml文件后,您已经将名称空间写成了"nexus",请尝试将名称空间更改为"default"来运行。

相关内容

  • 没有找到相关文章

最新更新