首页 > 其他分享 >sonarqube部署安装

sonarqube部署安装

时间:2023-05-31 22:45:18浏览次数:35  
标签:name 部署 sonarqube db sonar 安装 spec metadata

镜像准备

postgres:11.6
sonarqube:9.0.0-community
busybox:1.27.1

安装postgres

sonarqube7.9及以上使用postgres为数据库使用

 PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-mysql
  namespace: demo
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: nfs
  volumeMode: Filesystem

Deployment

kind: Deployment
apiVersion: apps/v1
metadata:
  name: sonar-db
  namespace: demo
  labels:
    app: sonar-db
    name: sonar-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonar-db
      name: sonar-db
  template:
    metadata:
      labels:
        app: sonar-db
        name: sonar-db
    spec:
      volumes:
        - name: sonar-mysql
          persistentVolumeClaim:
            claimName: sonar-mysql
      containers:
        - name: postgres
          image: 'postgres:11.6'
          ports:
            - containerPort: 5432
              protocol: TCP
          env:
            - name: POSTGRES_DB
              value: sonardb
            - name: POSTGRES_USER
              value: sonar
            - name: POSTGRES_PASSWORD
              value: sonar
          resources:
            limits:
              cpu: '1'
              memory: 2Gi
            requests:
              cpu: 800m
              memory: 2Gi
          volumeMounts:
            - name: sonar-mysql
              mountPath: /var/lib/postgresql/data
          imagePullPolicy: IfNotPresent
      restartPolicy: Always

Service

kind: Service
apiVersion: v1
metadata:
  name: sonar-db
  namespace: demo
  labels:
    name: sonar-db
spec:
  ports:
    - name: tcp-port-0
      protocol: TCP
      port: 5432
      targetPort: 5432
  selector:
    name: sonar-db
  type: ClusterIP

安装sonarqube

PVC

 
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-data
  namespace: demo
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: nfs
  volumeMode: Filesystem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-extensions
  namespace: demo
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
  storageClassName: nfs
  volumeMode: Filesystem

Deployment

kind: Deployment
apiVersion: apps/v1
metadata:
  name: sonarqube
  namespace: demo
  labels:
    app: sonarqube
    name: sonarqube
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonarqube
      name: sonarqube
  template:
    metadata:
      labels:
        app: sonarqube
        name: sonarqube
    spec:
      volumes:
        - name: sonar-extensions
          persistentVolumeClaim:
            claimName: sonar-extensions
        - name: sonar-data
          persistentVolumeClaim:
            claimName: sonar-data
      initContainers:
        - name: init-sysctl
          image: 'busybox:1.27.1'
          command:   # elasticsearch用户拥有的内存权限太小,es启动会报错,此命令保证es正常启动
            - sysctl
            - '-w'
            - vm.max_map_count=262144
          ports:
            - containerPort: 80
              protocol: TCP
          resources:
            limits:
              cpu: '1'
              memory: 2Gi
            requests:
              cpu: 800m
              memory: 2Gi
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
          securityContext:   # 配置特权
            privileged: true
      containers:
        - name: sonarqube
          image: 'sonarqube:9.0.0-community'
          ports:
            - containerPort: 9000
              protocol: TCP
          env:
            - name: SONARQUBE_JDBC_USERNAME
              value: sonar
            - name: SONARQUBE_JDBC_PASSWORD
              value: sonar
            - name: SONARQUBE_JDBC_URL
              value: 'jdbc:postgresql://sonar-db.demo:5432/sonardb'
          resources:
            limits:
              cpu: '1'
              memory: 4Gi
            requests:
              cpu: 800m
              memory: 2Gi
          volumeMounts:
            - name: sonar-extensions
              mountPath: /opt/sonarqube/extensions
            - name: sonar-data
              mountPath: /opt/sonarqube/data
          readinessProbe:
            httpGet:
              path: /
              port: 9000
              scheme: HTTP
            initialDelaySeconds: 240
            timeoutSeconds: 5
            periodSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          imagePullPolicy: IfNotPresent
          securityContext:
            privileged: false
      restartPolicy: Always

Service

kind: Service
apiVersion: v1
metadata:
  name: sonarqube
  namespace: demo
  labels:
    name: sonarqube
spec:
  ports:
    - name: tcp-port-0
      protocol: TCP
      port: 9000
      targetPort: 9000
  selector:
    name: sonarqube
  type: ClusterIP|NodePort

 

标签:name,部署,sonarqube,db,sonar,安装,spec,metadata
From: https://www.cnblogs.com/putaoo/p/17447545.html

相关文章

  • Vagrant编排虚拟机安装与配置
    1.安装VirtualBox与VagrantVirtualBox与Vagrant是支持不通过操作系统的;根据具体操作系统下载对应版本即可。(这里使用windows操作系统搭建)VirtualBoxhttps://www.virtualbox.org/wiki/DownloadsVagranthttps://developer.hashicorp.com/vagrant/downloadsVagrant是没有图形界面的......
  • 凝思6.0.80安装指南
    进入安装引导界面后,选择“advancedoptions…”进入advancedoptions…页面后,选择第三项“stateGridautomaticinstall”进入stateGridautomaticinstall页面后,选择“继续”在安装引导界面选择需要安装系统的硬盘,并开始对硬盘进行分区注意:如果选择UEFI安装模式,需要单独将EFI进......
  • 大数据展示框架SuperSet 安装
    标签(空格分隔):协作框架**1.1Superset概述**ApacheSuperset是一个现代的数据探索和可视化平台。它功能强大且十分易用,可对接各种数据源,包括很多现代的大数据分析引擎,拥有丰富的图表展示形式,并且支持自定义仪表盘。**1.2环境说明**本课程使用的服务器操作系统为CentOS7,Sup......
  • TensorFlow的安装和使用
    安装TensorFlow的步骤如下:安装Python:首先,确保你的计算机上安装了Python。TensorFlow支持Python3.5、3.6和3.7版本。你可以从Python官方网站(https://www.python.org/downloads/)下载适合你操作系统的Python安装程序,并按照指示进行安装。创建虚拟环境(可选):为了隔离TensorFlow的安装,你......
  • python离线下载安装第三方包
    下载离线安装包#dpackages选项表示将多个文件保存在packages文件夹下例:下载requestspipdownloadrequests-dpackages-ihttps://pypi.tuna.tsinghua.edu.cn/simple安装离线包#--find-links=路径选项来指定寻找依赖的路径,--no-index选项表示不要检查PyPI,以requests包......
  • Inofity+Rsync实时同步服务部署
    第一步:部署rsync服务1.1服务端:1.检查rsync是否安装[root@rsync-backup~]#rpm-qarsyncrsync-3.1.2-12.el7_9.x86_642.对rsync服务进行配置[root@rsync-backup~]#cat/etc/rsyncd.confuid=rsyncgid=rsyncfakesuper=yesusechroot=nomaxconnections=......
  • Razor Pages本地IIS服务器部署流程及部分问题解决方法
     记录一下自己在本地IIS服务器部署的基本流程:添加IIS服务器控制面板>>程序和功能 启用或关闭windows功能>>勾选相关功能   网站部署将项目发布(publish)至本地文件夹:在包含.sln文件的目录下打开终端,输入dotnetpublish-cdebug--no-self-contained......
  • docker安装
    1.官方按照链接:https://docs.docker.com/engine/install/centos/    2.配置镜像加速器登录阿里云:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors?accounttraceid=e1892dba7dce4d22a171aa260e87de01ueuh  ......
  • AI实战营第二期 | 环境配置及安装
    AI实战营第二期|环境配置及安装强烈推荐使用mim来管理OpenMMLabrepoOpenMMLabrepo不要mim和pip混用OpenMMLab1.0和OpenMMLab2.0环境分离,不要耦合在一个环境里面以下是比较推荐的初学者配置方式,进阶之后推荐使用软链接模式,详见:OpenMMLab2.0源码阅读和调......
  • Vs2022安装.Net4.5程序包
    因为VS2022将不再支持.NET4.5,即使在VisualStudioInstaller中也找不到.NET4.5的选项我们可以在NuGet包中下载.NET4.5的工具包找到程序包管理器控制台Vs2022顶部菜单>视图>其它窗口>程序包管理器控制台将下段代码复制进程序包管理器控制台然后回车Install-PackageMicrosof......