标签:load target type 自定义 dep lse 磁盘 limits source
搭建k8s集群
Docker search nexus
编写yaml文件
注意,以下的service不是nodeport,而是LoadBalancer
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: nexus
  labels:
    app: nexus
spec:
  serviceName: nexus
  replicas: 1
  selector:
    matchLabels:
      app: nexus
  template:
    metadata:
      labels:
        app: nexus
    spec:
      containers:
      - image: docker.io/sonatype/nexus3
        name: nexus
        ports:
        - containerPort: 8081
          protocol: TCP
          name: http
        resources:
          requests:
            cpu: 350m
            memory: 512Mi
          limits:
            cpu: 800m
            memory: 2Gi
      securityContext:
        runAsUser: 0
---
apiVersion: v1
kind: Service
metadata:
  name: nexus
spec:
  ports:
  - name: http
    port: 8081
    protocol: TCP
    targetPort: 8081
  selector:
    app: nexus
  type: LoadBalancer
启动pods
kubectl apply -f nexus.yaml
登录地址:http://ip:port/nexus,登录账号是admin,密码在文件里面
设置仓库参考https://www.cnblogs.com/wuwei928/p/10338307.html
https://www.cnblogs.com/endv/p/11204704.html
在Linux上通过mvn上传第三方jar/war包到nexus上
Linux如果是通过yum安装的mvn,那么默认的本地仓库是家目录下的.m2目录下
需要修改setting.xml全局配置文件才能上传到nexus上
通过mvn -V获取mvn的信息,找到/etc/maven/setting.xml
在文件中添加如下
<!--id自定义,但是在使用命令上传的时候会用到-->
<server> <id>myself_hosted</id> <username>admin</username> <password>admin123</password> </server>
然后
mvn deploy:deploy-file -DgroupId=sxd.jar -DartifactId=jacob -Dversion=1.18 -Dpackaging=jar -Dfile=./jacob-1.18.jar -Durl=http://localhost:8081/repository/myself_hosted/ -DrepositoryId=myself_hosted
-DgroupId=sxd.jar 自定义
-DartifactId=jacob 自定义
-Dversion=1.18 自定义 三个自定义,构成pom.xml文件中的坐标
-Dpackaging=jar 上传的类型是jar类型
-Dfile=G:\jar\jacob-1.18.jar jar的本地磁盘位置
-Durl=http://localhost:8081/repository/myself_hosted/ hosted资源库的地址,下图中
-DrepositoryId=myself_hosted setting.xml文件中配置的ID
标签:load target type 自定义 dep lse 磁盘 limits source
原文地址:https://www.cnblogs.com/allmdzz/p/12610635.html