Helm/SonarQube: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 11: Line 11:
==Install==
==Install==
{|
{|
|colspan="2"|
<syntaxhighlight lang="sql">
cat << DDL | psql -U ${USER}
CREATE DATABASE sonarqube;
CREATE USER sonarqube WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE  sonarqube TO sonarqube;
DDL
</syntaxhighlight>
|-
|colspan="2"|
----
|-
|colspan="2"|
|colspan="2"|
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">

Revision as of 13:03, 5 August 2024

helm repo add sonarqube https://SonarSource.github.io/helm-chart-sonarqube
helm repo update && helm repo list

Config

export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"

Install

cat << DDL | psql -U ${USER}
CREATE DATABASE sonarqube;
CREATE USER sonarqube WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE  sonarqube TO sonarqube;
DDL

kubectl create namespace sonarqube
helm show values sonarqube/sonarqube --version 10.6.1+3163|less
cat <<YML | helm install -n sonarqube sonarqube sonarqube/sonarqube --version 10.6.1+3163 -f -
ingress:
  enabled: true
  hosts:
    - name: sonarqube.k8s.local
      path: /
  annotations: 
    ingressClassName: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: 64m
initFs:
  enabled: true
initSysctl:
  enabled: true
elasticsearch:
  configureNode: false
  bootstrapChecks: true
postgresql:
  enabled: true
  postgresqlDatabase: sonarqube
  postgresqlUsername: sonarqube
  postgresqlPassword: "sadaqah!"
  persistence:
    storageClass: standard
account:
  adminPassword: admin
  currentAdminPassword: "sadaqah!"
YML

  xdg-open http://sonarqube.k8s.local &>/dev/null &
gnome-open http://sonarqube.k8s.local &>/dev/null &
   x-www-browser http://sonarqube.k8s.local &>/dev/null &
sensible-browser http://sonarqube.k8s.local &>/dev/null &

Uninstall

helm uninstall -n sonarqube sonarqube
kubectl delete namespace sonarqube

Playground

helm install -n sonarqube    sonarqube sonarqube/sonarqube --version 10.5.1+2816
helm upgrade -n sonarqube -i sonarqube sonarqube/sonarqube --version 10.6.1+3163
helm show values sonarqube/sonarqube --version 10.5.1+2816|less

kubectl exec -n sonarqube -it svc/sonarqube-postgresql -c sonarqube-postgresql -- psql -Usonarqube
kubectl exec -n sonarqube -it svc/sonarqube-postgresql -c sonarqube-postgresql -- bash
kubectl exec -n sonarqube -it svc/sonarqube-sonarqube  -c sonarqube -- bash
kubectl exec -n sonarqube -it sonarqube-postgresql-0 -- bash
kubectl exec -n sonarqube -it sonarqube-sonarqube-0  -- bash

kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten

kubectl delete all --all -n sonarqube
kubectl delete ing --all -n sonarqube
kubectl delete sts --all -n sonarqube
kubectl delete svc --all -n sonarqube
kubectl delete pvc --all -n sonarqube
kubectl delete pv  --all -n sonarqube

kubectl rollout -n sonarqube history sts sonarqube-sonarqube
kubectl rollout -n sonarqube restart sts sonarqube-sonarqube
kubectl rollout -n sonarqube status  sts sonarqube-sonarqube
kubectl exec -n sonarqube -it sonarqube-postgresql-0 -- psql -Usonarqube
kubectl logs -n sonarqube -f  sonarqube-postgresql-0
kubectl logs -n sonarqube -f  sonarqube-sonarqube-0

References