Deploy a Neo4J instance in Kubernetes

Deploy a Neo4J instance in Kubernetes

Using this manifest, a Neo4J instance can be deployed in a Kubernetes cluster

apiVersion: v1
kind: PersistentVolume
metadata:
  name: neo4j
  labels:
    type: local
spec:
  capacity:
    storage:
      10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/kubernetes/neo4j"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: neo4j
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: neo4j
spec:
  replicas: 1
  selector:
    matchLabels:
      app: neo4j
  template:
    metadata:
      labels:
        app: neo4j
    spec:
      volumes:
      - name: neo4j
        persistentVolumeClaim:
          claimName: neo4j
      containers:
      - name: neo4j
        image: neo4j
        env:
        - name: NEO4J_AUTH
          value: neo4j/newPassword
        ports:
        - containerPort: 7474 # Browser
        - containerPort: 7687 # Bolt
        volumeMounts:
        - mountPath: "/data"
          name: neo4j
---
apiVersion: v1
kind: Service
metadata:
  name: neo4j
spec:
  ports:
  - port: 7474
    nodePort: 30474
    name: http
  - port: 7687
    name: bolt
    nodePort: 30687
  selector:
    app: neo4j
  type: NodePort