helm repo add sonatype https://sonatype.github.io/helm3-charts
helm repo update && helm repo list
kubectl config get-contexts
Config
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
Install
kubectl -n postgresql exec -it svc/postgresql -c postgresql -- bash
echo -n password: ;read -s PGPASSWORD;export PGPASSWORD;echo
# -- drop if schema exists
cat << DDL | psql -U postgres
DROP DATABASE IF EXISTS nexus;
DROP USER IF EXISTS nexus;
DDL
# -- create nexus schema
cat << DDL | psql -U postgres
CREATE DATABASE nexus;
CREATE USER nexus WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE nexus TO nexus;
ALTER USER nexus WITH SUPERUSER;
DDL
kubectl delete namespace nexus
helm show values sonatype/nxrm-ha --version 72.0.0|less
|
kubectl get ns|grep nexus
kubectl create namespace nexus
cat << YML | kubectl -n nexus apply -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: nexus
name: nexus-pvc
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
YML
|
|
cat <<YML | helm -n nexus install nexus sonatype/nxrm-ha --version 72.0.0 -f -
---
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
hostPath: /
hostRepo: nexus.k8s.local
fullnameOverride: nexus
nexus:
docker:
enabled: false
registries:
- host: docker.k8s.local
port: 8082
env:
- name: INSTALL4J_ADD_VM_PARAMS
value: |-
-Xms2703M -Xmx2703M
-XX:MaxDirectMemorySize=2703M
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
-Djava.util.prefs.userRoot=/nexus-data/javaprefs
-XX:LogFile=/nexus-data/home/log/jvm.log
- name: NEXUS_SECURITY_RANDOMPASSWORD
value: "true"
resources:
requests:
cpu: 2
memory: 2Gi
limits:
cpu: 4
memory: 4Gi
persistence:
enabled: true
storageSize: 10Gi
storageClass: standard
existingClaim: nexus-pvc
accessMode: ReadWriteOnce
serviceAccount:
create: true
name: nexsu-sa
YML
|
|
xdg-open http://nexus.k8s.local &>/dev/null &
gnome-open http://nexus.k8s.local &>/dev/null &
|
x-www-browser http://nexus.k8s.local &>/dev/null &
sensible-browser http://nexus.k8s.local &>/dev/null &
|
Uninstall
helm uninstall -n nexus nexus
kubectl delete namespace nexus
Playground
helm -n nexus install nexus sonatype/nxrm-ha --version 70.0.0
helm -n nexus upgrade -i nexus sonatype/nxrm-ha --version 72.0.0
helm show values sonatype/nxrm-ha --version 72.0.0|less
|
|
NEXUS_POD_NAME="$(kubectl -n nexus get pod -l 'app.kubernetes.io/name=nexus-repository-manager' -o json|jq -r '.items[0].metadata.name')"
kubectl -n nexus exec -it svc/nexus -c nexus-repository-manager -- cat /nexus-data/admin.password;echo
kubectl -n nexus exec -it svc/nexus -c nexus-repository-manager -- 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 -n nexus delete all --all
kubectl -n nexus delete ing --all
kubectl -n nexus delete sts --all
|
kubectl -n nexus delete svc --all
kubectl -n nexus delete pvc --all
kubectl -n nexus delete pv --all
|
|
kubectl -n nexus rollout history deploy nexus-repository-manager
kubectl -n nexus rollout restart deploy nexus-repository-manager
kubectl -n nexus rollout status deploy nexus-repository-manager
|
kubectl -n nexus exec -it svc/nexus -- cat /nexus-data/admin.password;echo
kubectl -n nexus logs -f svc/nexus -c nexus-repository-manager
kubectl -n nexus logs -f ${NEXUS_POD_NAME}
|
References