您好,登录后才能下订单哦!
1、环境介绍
2、安装nexus
helm search repo nexus
helm pull stable/sonatype-nexus
tar xvf sonatype-nexus-1.21.2.tgz
helm install nexus ./sonatype-nexus
kubectl get pod
kubectl describe pod nexus-sonatype-nexus-79b5865bbc-4lb49
从而得知在请求pvc,所以创建pv
vim pv.yaml #这里采用的hostpath apiVersion: v1 kind: PersistentVolume metadata: name: nexus-pv spec: capacity: storage: 10Gi volumeMode: Filesystem accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Retain hostPath: path: /helm/nexus
mkdir -p /helm/nexus #在worker节点创建相应的目录 kubecel apply -f pv.yaml
查看pod状态
kubectl get pod
kubectl logs nexus-sonatype-nexus-79b5865bbc-4lb49 #会报错,是因为容器的名字重复“nexus nexus-proxy” Error from server (BadRequest): a container name must be specified for pod nexus-sonatype-nexus-79b5865bbc-4lb49, choose one of: [nexus nexus-proxy]
kubectl edit deploy nexus-sonatype-nexus
修改nexus-proxy为nexus
再次查看pod状态,还是有问题
kubectl logs nexus-sonatype-nexus-64c75f5786-gtvlg Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file /nexus-data/log/jvm.log due to No such file or directory Warning: Cannot open log file: /nexus-data/log/jvm.log Warning: Forcing option -XX:LogFile=/tmp/jvm.log Unable to update instance pid: Unable to create directory /nexus-data/instances /nexus-data/log/karaf.log (No such file or directory) Unable to update instance pid: Unable to create directory /nexus-data/instances
从而得知是目录/nexus-data/instances没有权限
kubectl get deploy nexus-sonatype-nexus -oyaml
是因为我们创建的pv没有权限,在worker节点给与刚才创建pv的目录777权限
chmod 777 /helm/nexus/
kubectl delete pod nexus-sonatype-nexus-64c75f5786-gtvlg #删掉原来的pod
完美起来了。
kubectl get svc
然后会发现端口不通
telnet 192.18.10.12 30070 Trying 192.18.10.12... telnet: connect to address 192.18.10.12: Connection refused
vim /root/nexus/sonatype-nexus/values.yaml
可以看到8080并不是nexus的真正端口,而真正的端口是
所以又要修改service文件
kubectl edit svc nexus-sonatype-nexus
再访问即可进入
用户名是admin,密码是admin123
完美结束!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。