Setup Nexus OSS On Kubernetes
1 min readMay 9, 2019
First lets create a namespace called devops-tools
1 | create a namespace called devops-tools
kubectl create namespace devops-tools
2 |Create the deployment using kubectl command
Now create nexus.yml file and copy following code in that.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nexus
namespace: devops-tools
spec:
replicas: 1
template:
metadata:
labels:
app: nexus-server
spec:
containers:
- name: nexus
image: sonatype/nexus3:latest
resources:
limits:
memory: "4Gi"
cpu: "1000m"
requests:
memory: "2Gi"
cpu: "500m"
ports:
- containerPort: 8081
volumeMounts:
- name: nexus-data
mountPath: /nexus-data
volumes:
- name: nexus-data
emptyDir: {}
3 | Create the deployment using kubectl command
kubectl create -f nexus.yml
4 | Check the deployment pod status
kubectl get pods -n devops-tools
Now create nexusservice.yml file and copy following code in that.
apiVersion: v1
kind: Service
metadata:
name: nexus-service
namespace: devops-tools
annotations:
prometheus.io/scrape: 'true'
prometheus.io/path: /
prometheus.io/port: '8081'
spec:
selector:
app: nexus-server
type: NodePort
ports:
- port: 8081
targetPort: 8081
nodePort: 32000
5 |Create Service using kubectl command
kubectl create -f nexusservice.yml
6 |Check the service configuration.
kubectl describe service nexus-service -n devops-tools
7 |Check the URL
http://<MASTER_NODE_IP>:32000
Note: The default username and password will be admin & admin123
References: