Myluzh Blog

K8S部署Nexus3 & 重置Nexus3密码

发布时间: 2024-10-23 文章作者: myluzh 分类名称: Kubernetes 朗读文章


0x01 部署yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nexus3
  namespace: base-ops
spec:
  replicas: 1
  selector:
    matchLabels:
      workload.user.cattle.io/workloadselector: deployment-base-ops-nexus3
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        workload.user.cattle.io/workloadselector: deployment-base-ops-nexus3
    spec:
      containers:
      - name: nexus3
        image: sonatype/nexus3:3.37.3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 8081
          hostPort: 8082
          name: 8081tcp80820
          protocol: TCP
        volumeMounts:
        - mountPath: /nexus-data
          name: vol1
      volumes:
      - name: vol1
        hostPath:
          path: /data/nexus-data


0x02 重置密码
#进入容器
root@k8s-master:~# kubectl get pod -n base-ops | grep nexus
nexus3-69b47c947f-bdggc     1/1     Running   0          63d
root@ks8-master:~# kubectl exec -it nexus3-69b47c947f-bdggc -n base-ops -- /bin/sh
sh-4.4$ 
#启动客户端服务
java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar
#连接数据库
connect plocal:/nexus-data/db/security admin admin
#更新密码为admin123
update user SET password="$shiro1$SHA-512$1024$NE+wqQq/TmjZMvfI7ENh/g==$V4yPw8T64UQ6GfJfxYq2hLsVrBY8D1v+bktfOxGdt4b/9BthpWPNUy/CBk6V9iA0nHpzYzJFWO8v/tZFtES8CA==" UPSERT WHERE id="admin"

参考文章:
nexus3修改admin密码 https://www.shuzhiduo.com/A/obzbKGPBJE/
记一次docker安装nexus3重制密码 https://blog.csdn.net/haoqi9999/article/details/130987678

标签: k8s java 部署 k8s部署 nexus nexus3

发表评论