From 414d475d9ea273bb5f587449b40c4f87b7b1fdb2 Mon Sep 17 00:00:00 2001 From: youngsuKim-CSUSB <81013158+youngsuKim-CSUSB@users.noreply.github.com> Date: Sat, 18 Sep 2021 17:37:31 -0700 Subject: [PATCH] Add yaml files --- depolyment-sagemath.yaml | 58 ++++++++++++++++++++++++++++++++++++++++ ingress-sagemath.yaml | 22 +++++++++++++++ pvc-sagemath.yaml | 13 +++++++++ service-clusterip.yml | 15 +++++++++++ 4 files changed, 108 insertions(+) create mode 100644 depolyment-sagemath.yaml create mode 100644 ingress-sagemath.yaml create mode 100644 pvc-sagemath.yaml create mode 100644 service-clusterip.yml diff --git a/depolyment-sagemath.yaml b/depolyment-sagemath.yaml new file mode 100644 index 0000000..ef3095c --- /dev/null +++ b/depolyment-sagemath.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: sagemath + labels: + k8s-app: sagemath + # Change below to your namespace; bypasses -n namesapce + # namespace: csusb-ykim +spec: + replicas: 1 + selector: + matchLabels: + k8s-app: sagemath + template: + metadata: + labels: + k8s-app: sagemath + spec: + containers: + - name: sagemath + image: gitlab-registry.nrp-nautilus.io/youngsu_kim/csusb-meyer-sagemath/sagemath/sagemath:latest + # Above image is from + # sagemath/sagemath:9.1 + resources: + limits: + memory: "2G" + cpu: "2" + # nvidia.com/gpu: "1" + requests: + memory: "1G" + cpu: "1" + # nvidia.com/gpu: "0" + command: ["sh", "-c", "ln -s /mnt/examplevol/ ~/pvc-sage-meyer && cd pvc-sage-meyer ; sage -n jupyter --no-browser --ip='0.0.0.0' && sleep infinity"] + # command: ["sh", "-c", "ln -s /mnt/examplevol/ ~/pvc-sage-meyer && cd pvc-sage-meyer && sage -n jupyter --no-browser --ip='0.0.0.0' && sleep infinity"] + # Below requires having a PVC running + volumeMounts: + - mountPath: /mnt/examplevol + name: examplevol + volumes: + - name: examplevol + persistentVolumeClaim: + claimName: sagemath-meyer +# --- +# apiVersion: v1 +# kind: Service +# metadata: +# labels: +# k8s-app: sagemath +# name: sagemath-svc +# spec: +# ports: +# - port: 8888 +# protocol: TCP +# targetPort: 8888 +# # The name of the selecter needs to match with metadata.labels.k8s-app +# selector: +# k8s-app: sagemath +# type: ClusterIP \ No newline at end of file diff --git a/ingress-sagemath.yaml b/ingress-sagemath.yaml new file mode 100644 index 0000000..7fef45e --- /dev/null +++ b/ingress-sagemath.yaml @@ -0,0 +1,22 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: haproxy + name: sagemath-ingress +spec: + rules: + - host: sagemath.nrp-nautilus.io + http: + paths: + - path: / + pathType: Prefix + # Maybe the following name needs to match with the one in service.metadata.labels.k8s-app + backend: + service: + name: sagemath-svc + port: + number: 8888 + tls: + - hosts: + - sagemath.nrp-nautilus.io \ No newline at end of file diff --git a/pvc-sagemath.yaml b/pvc-sagemath.yaml new file mode 100644 index 0000000..b3062a3 --- /dev/null +++ b/pvc-sagemath.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: sagemath-meyer + # namespace: csusb-ykim +spec: + storageClassName: rook-ceph-block + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + # Chage the size above if necessary \ No newline at end of file diff --git a/service-clusterip.yml b/service-clusterip.yml new file mode 100644 index 0000000..1cc8621 --- /dev/null +++ b/service-clusterip.yml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + k8s-app: sagemath + name: sagemath-svc +spec: + ports: + - port: 8888 + protocol: TCP + targetPort: 8888 + # The name of the selecter needs to match with metadata.labels.k8s-app + selector: + k8s-app: sagemath + type: ClusterIP \ No newline at end of file -- GitLab