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
cat << DDL | psql -U postgres
DROP DATABASE IF EXISTS nexus;
DROP USER IF EXISTS nexus;
DDL
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/nexus-repository-manager --version 64.2.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/nexus-repository-manager --version 64.2.0 -f -
---
fullnameOverride: nexus
ingress:
enabled: true
ingressClassName: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "0"
hostPath: /
hostRepo: nexus.k8s.local
serviceAccount:
create: true
name: "nexsu-sa"
persistence:
storageClass: "standard"
nexus:
docker:
enabled: false
registries:
- host: docker.k8s.local
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
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/nexus-repository-manager --version 64.2.0
helm -n nexus upgrade -i nexus sonatype/nexus-repository-manager --version 64.2.0
helm show values sonatype/nexus-repository-manager --version 64.2.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-repository-manager -c nexus-repository-manager -- cat /nexus-data/admin.password;echo
kubectl -n nexus exec -it svc/nexus-repository-manager -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 logs -f svc/nexus-repository-manager -c nexus-repository-manager
kubectl -n nexus exec -it ${NEXUS_POD_NAME} -- bash
kubectl -n nexus logs -f ${NEXUS_POD_NAME}
|
References