kubernetes部署Nexus(Helm3)

news2024/10/12 5:43:52

参考文献:

  • https://help.sonatype.com/en/single-data-center-on-premises-deployment-example-using-kubernetes.html
  • https://github.com/sonatype/helm3-charts
  • https://support.sonatype.com/hc/en-us/articles/7706583820691-How-to-install-Nexus-Pro-instance-using-Sonatype-helm3-chart

Nexus3简介

Nexus 是 Maven 仓库管理器,通过 nexus 可以搭建 Maven仓库,极大的简化了本地内部仓库的维护和外部仓库的访问,同时是一套开箱即用的系统不需要数据库,并且还提供强大的仓库管理、构建、搜索等功能

优点

  • 节省外网带宽
  • 加速Maven构建
  • 可以为本地建立本地内部仓库
  • 方便项目组存放各种jar的管理

部署 PVC

准备命名空间

kubectl create ns ops-nexus

创建PVC

cat > nexus-volume.yaml <<EOF
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-nexus-storage
spec:
  accessModes:
    - ReadWriteMany
  # 指定 storageClass 的名字,这里使用默认的 standard
  storageClassName: nfs-storage
  resources:
    requests:
      storage: 1000Gi
EOF
kubectl apply -f nexus-volume.yaml -n ops-nexus

华为云SFS配置

---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: pv-efs-ops-nexus
  annotations:
    everest.io/reclaim-policy: retain-volume-only
    pv.kubernetes.io/bound-by-controller: 'yes'
    pv.kubernetes.io/provisioned-by: everest-csi-provisioner
  finalizers:
    - kubernetes.io/pv-protection
spec:
  capacity:
    storage: 1000Gi
  csi:
    driver: sfsturbo.csi.everest.io
    volumeHandle: pv-efs-ops-nexus
    fsType: nfs
    volumeAttributes:
      everest.io/enterprise-project-id: cfxxxx4d-16c4-4206-a3cb-111xxxxbyyy
      everest.io/sfsturbo-share-id: 73xxxx6a-6xxx-xxx0-8xxx-fxxxxx6cxxxx
      storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner
      everest.io/share-export-location: 73xxxx6a-6xxx-xxx0-8xxx-fxxxxx6cxxxx.sfsturbo.internal:/Nexus
      everest.io/volume-as: absolute-path
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: csi-sfsturbo
  mountOptions:
    - vers=3
    - timeo=600
    - nolock
    - hard
  volumeMode: Filesystem

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvc-nexus-storage
  annotations:
    everest.io/enterprise-project-id: cfxxxx4d-16c4-4206-a3cb-111xxxxbyyy
    pv.kubernetes.io/bind-completed: 'yes'
    volume.beta.kubernetes.io/storage-provisioner: everest-csi-provisioner
  finalizers:
    - kubernetes.io/pvc-protection
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1000Gi
  volumeName: pv-efs-ops-nexus
  storageClassName: csi-sfsturbo
  volumeMode: Filesystem

获取Chart配置

将 Sonatype Repo 添加到你的 Helm

helm repo add sonatype https://sonatype.github.io/helm3-charts/

获取图表的values.yaml默认值。

  • Nexus 存储库管理器 OSS/Pro:
helm show values sonatype/nexus-repository-manager > nexus-repo-values.yaml
  • Nexus IQ:
helm show values sonatype/nexus-iq-server > iq-values.yaml
  • AWS 弹性 Nexus 存储库管理器:
helm show values sonatype/nxrm-aws-resiliency  > aws-resiliency-values.yaml

将该输出捕获为您自己的values.yaml文件,并将其helm install 与-f选项一起提供给命令。

配置Nexus3

配置案例

---
statefulset:
  # This is not supported
  enabled: false
# Nexus 不支持使用同一 pvc 运行多个实例。请参阅:https://help.sonatype.com/repomanager3/planning-your-implementation/resiliency-and-high-availability/single-data-center-on-residential-deployment-example-using-kubernetes
replicaCount: 1
deploymentStrategy: Recreate
image:
  # Sonatype Official Public Image
  repository: sonatype/nexus3
  tag: 3.64.0
  pullPolicy: IfNotPresent
imagePullSecrets:
# for image registries that require login, specify the name of the existing
# kubernetes secret
#   - name: <pull-secret-name>

nexus:
  docker:
    enabled: false
    # registries:
    #   - host: chart.local
    #     port: 5000
    #     secretName: registry-secret
  env:
    # minimum recommended memory settings for a small, person instance from
    # https://help.sonatype.com/repomanager3/product-information/system-requirements
    - name: INSTALL4J_ADD_VM_PARAMS
      value: "-Xms2703M -Xmx2703M -XX:MaxDirectMemorySize=2703M -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Djava.util.prefs.userRoot=/nexus-data/javaprefs"
    - name: NEXUS_SECURITY_RANDOMPASSWORD
      value: "true"
  properties:
    override: false
    data:
      nexus.scripts.allowCreation: true
      # See this article for ldap configuratioon options https://support.sonatype.com/hc/en-us/articles/216597138-Setting-Advanced-LDAP-Connection-Properties-in-Nexus-Repository-Manager
      # nexus.ldap.env.java.naming.security.authentication: simple
  # nodeSelector:
  #   cloud.google.com/gke-nodepool: default-pool
  nodeSelector:
    dependable: "true"
    env: ops
  resources:
  # minimum recommended memory settings for a small, person instance from
  # https://help.sonatype.com/repomanager3/product-information/system-requirements
  #   requests:
  #     cpu: 4
  #     memory: 8Gi
  #   limits:
  #     cpu: 4
  #     memory: 8Gi
     requests:
       cpu: 1
       memory: 512Mi
     limits:
       cpu: 4
       memory: 8Gi

  # The ports should only be changed if the nexus image uses a different port
  nexusPort: 8081

  # Default the pods UID and GID to match the nexus3 container.
  # Customize or remove these values from the securityContext as appropriate for
  # your deployment environment.
  securityContext:
    runAsUser: 200
    runAsGroup: 200
    fsGroup: 200
  podAnnotations: {}
  livenessProbe:
    initialDelaySeconds: 30
    periodSeconds: 30
    failureThreshold: 6
    timeoutSeconds: 10
    path: /
  readinessProbe:
    initialDelaySeconds: 30
    periodSeconds: 30
    failureThreshold: 6
    timeoutSeconds: 10
    path: /
  # hostAliases allows the modification of the hosts file inside a container
  hostAliases: []
  # - ip: "192.168.1.10"
  #   hostnames:
  #   - "example.com"
  #   - "www.example.com"

nameOverride: "nexus-repository"
fullnameOverride: "nexus-repository"

deployment:
  # # Add annotations in deployment to enhance deployment configurations
  annotations: {}
  # # Add init containers. e.g. to be used to give specific permissions for nexus-data.
  # # Add your own init container or uncomment and modify the given example.
  initContainers:
  ## 如果因文件权限启动异常,请打开以下容器配置
  #- name: fmp-volume-permission
  #  image: busybox
  #  imagePullPolicy: IfNotPresent
  #  command: ['chown','-R', '200', '/nexus-data']
  #  volumeMounts:
  #    - name: nexus-repository-data
  #      mountPath: /nexus-data

  # Uncomment and modify this to run a command after starting the nexus container.
  postStart:
    command:    # '["/bin/sh", "-c", "ls"]'
  preStart:
    command:    # '["/bin/rm", "-f", "/path/to/lockfile"]'
  terminationGracePeriodSeconds: 120
  additionalContainers:
  additionalVolumes:
  additionalVolumeMounts:

ingress:
  #enabled: false
  enabled: true
  ingressClassName: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/connection-proxy-header: ""
    nginx.ingress.kubernetes.io/keep-alive: "650"
    nginx.ingress.kubernetes.io/keep-alive-requests: "10000"
    nginx.ingress.kubernetes.io/proxy-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "7200"
    nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
    nginx.ingress.kubernetes.io/proxy-next-upstream: error timeout invalid_header http_500 http_502 http_503 http_504
    nginx.ingress.kubernetes.io/proxy-read-timeout: "7200"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "7200"
    nginx.ingress.kubernetes.io/proxy-tcp-nodelay: "on"
    nginx.ingress.kubernetes.io/proxy-tcp-nopush: "off"
    nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
  hostPath: /
  hostRepo: nexus.qshtest.com
  # tls:
  #   - secretName: nexus-local-tls
  #     hosts:
  #       - repo.demo


service:
  name: nexus3
  enabled: true
  labels: {}
  annotations: {}
  type: ClusterIP


route:
  enabled: false
  name: docker
  portName: docker
  labels:
  annotations:
  # path: /docker

nexusProxyRoute:
  enabled: false
  labels:
  annotations:
  # path: /nexus

persistence:
  enabled: true
  accessMode: ReadWriteOnce
  ## If defined, storageClass: <storageClass>
  ## If set to "-", storageClass: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClass spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  # existingClaim:
  # annotations:
  #  "helm.sh/resource-policy": keep

  # 如果你已经有一个现有的 PVC,可以在此处引用它。
  existingClaim: pvc-nexus-storage
  # 如果你想在 Helm 升级时保留资源,添加如下注释:
  annotations:
    "helm.sh/resource-policy": keep
  # storageClass: "-"
  storageSize: 500Gi
  # If PersistentDisk already exists you can create a PV for it by including the 2 following keypairs.
  # pdName: nexus-data-disk
  # fsType: ext4

#tolerations: []
tolerations:
- key: "core"
  operator: "Equal"
  value: "true"
  effect: "NoSchedule"

# Enable configmap and add data in configmap
config:
  enabled: false
  mountPath: /sonatype-nexus-conf
  data: []

# # To use an additional secret, set enable to true and add data
secret:
  enabled: false
  mountPath: /etc/secret-volume
  readOnly: true
  data: []

serviceAccount:
  # Specifies whether a service account should be created
  create: true
  # Annotations to add to the service account
  annotations: {}
  # The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: ""

部署Nexus3

创建命名空间

kubectl create ns ops-nexus

部署服务

Nexus 存储库管理器 OSS/Pro:

helm install nexus-repo -f nexus-repo-values.yaml sonatype/nexus-repository-manager -n ops-nexus

更新服务

helm upgrade nexus-repo -f ./nexus-repo-values.yaml sonatype/nexus-repository-manager -n ops-nexus

迁移现有 Nexus 存储库

  • https://help.sonatype.com/en/migrating-an-existing-nexus-repository-instance-to-a-resiliency-architecture.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2207143.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

python networkx 计算路径A*

import matplotlib.pyplot as plt # 导入 Matplotlib 工具包 import networkx as nx # 导入 NetworkX 工具包 from typing import List# 初始化空的无向图 graph nx.Graph() # 向图中添加多条赋权边: (node1,node2,weight) graph.add_weighted_edges_from([(1, 2, 50),(1, 3…

智能扭矩系统在制造领域应用_SunTorque

【大家好&#xff0c;我是唐Sun&#xff0c;唐Sun的唐&#xff0c;唐Sun的Sun。一站式数智工厂解决方案服务商】 在当今高度自动化和智能化的制造领域&#xff0c;各种先进技术不断涌现&#xff0c;为提高生产效率、保证产品质量和降低成本提供了有力支持。智能扭矩系统作为其中…

【电子电力】基于DSP28335+DSP28035的三相三电平大功率并网逆变器程序代码

摘要 本文介绍了基于DSP28335和DSP28035的三相三电平大功率并网逆变器设计和实现。通过DSP控制器对三电平逆变器的精确控制&#xff0c;实现了逆变器与电网的并网控制&#xff0c;保证了系统的高效稳定运行。该设计主要应用于光伏发电和风力发电系统中的并网发电部分。本文通过…

在AI大模型时代遨游,你不得不知道的一些事

用户到底为什么而买单/产品和研发要抛弃的历史包袱 在大模型时代之前&#xff0c;其实企业和企业之间的软件产品壁垒来自两个地方&#xff1a; 交互&#xff0c;让用户用起来感觉舒服。打磨&#xff0c;我花了五年修复了用户遇到的一万个bug,所以我的产品比你好。 但是无论如何…

如何使用flutter doctor命令检测环境是否配置成功

Flutter Windows Android环境搭建 真机调试学习地址&#xff1a; 17 Flutter介绍-Flutter Windows Android环境搭建 真机调试 如何使用flutter doctor命令检测环境是否配置成功&#xff0c;详细步骤如下&#xff1a; 第一次执行可能会提示下面错误&#xff1a; 1、错误一&am…

建站:腾讯云+宝塔linux+xftp

1.首先&#xff0c;控制台&#xff0c;服务器 2.服务器-网络与域名-ip地址&#xff0c;能看到公网地址 3.宝塔Linux面板-网站-添加站点 4.填写域名会自动生成 ftp 帐号密码 域名可以加上端口&#xff0c;端口号可以写大点 5.xftp新建会话 主机地址&#xff1a;腾讯云拿到的公…

直流有刷电机驱动芯片:【TOSHIBA:TB6612】

Toshiba TB6612是是东芝半导体的一款驱动电机的IC。一个TB6612FNG可以驱动两个电机&#xff0c;每一个驱动都有两个逻辑输入引脚&#xff0c;一个输出引脚和一个PWM引脚。可以通过给两个逻辑输入引脚不同的电平来控制电机的运行状态&#xff0c;通过PWM输入引脚实现电机调速。 …

怎么看待数字化转型是大势所趋?

怎么看到数字化转型是大势所趋&#xff1f;下面我结合最新数据给大家讲明白这个事。 近日&#xff0c;我通过大量的数据相关性分析&#xff0c;有了一些关键发现。 【数字化转型】之所以势在必行&#xff0c;主要是因为数字化转型为各个国家数字经济发展提供了重要的参考依据。…

R2:RNN-心脏病预测

&#x1f368; 本文为&#x1f517;365天深度学习训练营 中的学习记录博客&#x1f356; 原作者&#xff1a;K同学啊 一、实验目的&#xff1a; 本地读取并加载数据。了解循环神经网络&#xff08;RNN&#xff09;的构建过程测试集accuracy到达87% 拔高&#xff1a;测试集accur…

腾讯云Android 相关

集成遇到异常怎么办&#xff1f; 您可以使用 armeabi 和 armeabi-v7a 架构。 如上图所示&#xff0c;请在app的 build.gradle 中指定 abiFilters 为“armeabi”。 功能模块升级后&#xff0c;短视频 SDK 的功能不能使用&#xff1f; 1. 如果使用的是 androidstudio&#xff0…

2024Selenium自动化常见问题!

"NoSuchElementException"异常&#xff1a; 确保使用了正确的选择器来定位元素。可以使用id、class、XPath或CSS选择器等。 可以尝试使用find_elements方法来查找元素列表&#xff0c;并检查列表的长度来判断元素是否存在。 使用显式等待&#xff08;WebDriverWait…

考研编程:10.11 回文数 水仙花 生成一定范围内的随机数 求二叉树宽度

回文数 #include <stdio.h>int main(){int a,b,c0,sum;scanf("%d",&a);ba;while(b!0){c b%10 c*10;b b/10;}if(ca){printf("yes");}return 0; } 水仙花 #include <stdio.h> #include <math.h> int main(){int a,b,c0,sum;scan…

内嵌服务器Netty Http Server

内嵌式服务器不需要我们单独部署&#xff0c;列如SpringBoot默认内嵌服务器Tomcat,它运行在服务内部。使用Netty 编写一个 Http 服务器的程序&#xff0c;类似SpringMvc处理http请求那样。举例&#xff1a;xxl-job项目的核心包没有SpringMvc的Controller层&#xff0c;客户端却…

css多层嵌套折叠

<!DOCTYPE html> <html lang"zh"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>美观的纯 CSS 折叠列表</title><style>b…

如何使用Python爬虫处理JavaScript动态加载的内容?

JavaScript已经成为构建动态网页内容的关键技术。这种动态性为用户带来了丰富的交互体验&#xff0c;但同时也给爬虫开发者带来了挑战。传统的基于静态内容的爬虫技术往往无法直接获取这些动态加载的数据。本文将探讨如何使用Python来处理JavaScript动态加载的内容&#xff0c;…

值类型和引用类型的使用

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace ConsoleApp1 {class Program{static void Main(string[] args){/****值类型****/bool test;//必须赋值,否则报错test true;Console.WriteLin…

修改svg图片颜色(结合sass)

1.下载sass npm install sass -gnpm install --save-dev sass-loader 我使用的版本 2.使用步骤 1.新建style文件夹&#xff0c;以及新建variable.scss&#xff0c;mixin.scss&#xff0c;main.scss 2.variable.scss $color_1:#50E3C2; $color_2:#FFF; 3.mixin.scss char…

大规模出海!新松移动机器人大批量进驻欧洲本土新能源市场

秋日的沈阳&#xff0c;天空高远而湛蓝。曙光下的新松智慧园&#xff0c;百余台移动机器人在车间内整齐列阵、蓄势待发&#xff0c;等待着最后的检验与封装&#xff0c;即将横跨千山万水远赴欧洲大地&#xff0c;开启中国移动机器人大规模进驻欧洲本土新能源市场的崭新篇章&…

2022年黄河流域旅游资源空间分布数据(shp)

数据介绍 黄河是中华民族的母亲河。黄河流域旅游资源丰富且极具特色。黄河流域旅游资源空间分布数据是黄河流域旅游资源开发与决策的基础。本数据集以县&#xff08;区&#xff09;域行政边界为单元、以国家旅游资源分类标准为依据&#xff0c;收集整理了黄河流域各县&#xf…

STM32-DMA直接存储器存取

一、概述 DMA&#xff08;Direct Memory Access&#xff09;直接存储器存取 DMA可以提供外设和存储器或者存储器和存储器之间的高速数据传输&#xff0c;无须CPU干预&#xff0c;节省了CPU的资源12个独立可配置的通道&#xff1a;DMA1(7个通道)&#xff0c;DMA2&#xff08;5…