apiVersion: apps/v1
kind: Deployment
metadata:
  name: crux-api
  namespace: crux-dev
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec: 
      containers:
        - name: utility-container
          image: centos:7.9.2009  # Replace with your Docker image name and tag
          command: ["/bin/bash","-c","--"]
          args: ["while true; do sleep 180; done; mkdir -p /var/crux"]
          ports:
          - containerPort: 8081
          volumeMounts:
          - mountPath: "/var/crux"
            name: crux-dev-api-data-pv-volume
      volumes:
        - name: crux-dev-api-data-pv-volume
          persistentVolumeClaim:
            claimName: crux-dev-api-data-pv-claim
      nodeSelector:
        name: node-1

---
apiVersion: v1
kind: Service
metadata:
  name: crux-api-service
  namespace: crux-dev
spec:
  selector:
    app: backend
  ports:
    - protocol: TCP
      port: 8081   
      targetPort: 8081
      nodePort: 31011
  type: NodePort

---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: crux-dev-api-data-pv-volume
  namespace: crux-dev
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 500Mi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/kra-data/data/dev/crux-dev/backend"


---


apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: crux-dev-api-data-pv-claim
  namespace: crux-dev
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi
