Sonarqube篇-k8s内安装sonarqube 7.8+连接外部Mysql 5.7和LDAP

1 创建pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonarqube-pvc
  namespace: sonarqube
  labels:
    app: sonarqube
spec:
  storageClassName: rook-ceph-block   #修改成自己的storageclass
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

2 创建deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: sonarqube
  namespace: sonarqube
  labels:
    app: sonarqube
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonarqube
  template:
    metadata:
      labels:
        app: sonarqube
    spec:
      initContainers:
      - name: init-sysctl
        image: busybox
        imagePullPolicy: IfNotPresent
        command: ["sysctl", "-w", "vm.max_map_count=262144"]
        securityContext:
          privileged: true
      containers:
      - name: sonarqube
        image: sonarqube:7.8-community
        ports:
        - containerPort: 9

你可能感兴趣的:(自动化运维)