From 270c3983eea7409423951e2af47347d268ca815e Mon Sep 17 00:00:00 2001 From: root Date: Fri, 13 Jun 2025 18:15:36 +0900 Subject: [PATCH] last --- gateway.yaml | 38 +++++++++ gateway2.yaml | 38 +++++++++ gpuaas/nfs-provisioner/test-claim.yaml | 2 +- gpuaas/nfs-provisioner/user-sc.yaml | 9 ++ gpuaas/sample_pod/tf-istio.yaml | 110 +++++++++++++++++++++++++ monitoring/fail.yaml | 22 +++++ monitoring/pending.yaml | 26 ++++++ monitoring/scp.sh | 2 +- svc.yaml | 13 +++ svc2.yaml | 13 +++ test.yaml | 33 ++++++++ test2.yaml | 33 ++++++++ 12 files changed, 337 insertions(+), 2 deletions(-) create mode 100644 gateway.yaml create mode 100644 gateway2.yaml create mode 100644 gpuaas/nfs-provisioner/user-sc.yaml create mode 100644 gpuaas/sample_pod/tf-istio.yaml create mode 100644 monitoring/fail.yaml create mode 100644 monitoring/pending.yaml create mode 100644 svc.yaml create mode 100644 svc2.yaml create mode 100644 test.yaml create mode 100644 test2.yaml diff --git a/gateway.yaml b/gateway.yaml new file mode 100644 index 0000000..a8b85de --- /dev/null +++ b/gateway.yaml @@ -0,0 +1,38 @@ +# Gateway.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: ssh2-gateway + namespace: default +spec: + # The selector matches the ingress gateway pod labels. + # If you installed Istio using Helm following the standard documentation, this would be "istio=ingress" + selector: + istio: ingressgateway + servers: + - port: + number: 80 + name: http + protocol: TCP + hosts: + - ssh2.nhngpuaas.com +--- +# virtual-service.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: test-2 + namespace: default +spec: + hosts: + - "ssh2.nhngpuaas.com" + gateways: + - ssh2-gateway + tcp: + - match: + - port: 8080 + route: + - destination: + port: + number: 2222 + host: ssh-service-2 diff --git a/gateway2.yaml b/gateway2.yaml new file mode 100644 index 0000000..a134e18 --- /dev/null +++ b/gateway2.yaml @@ -0,0 +1,38 @@ +# Gateway.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: ssh-gateway + namespace: org1 +spec: + # The selector matches the ingress gateway pod labels. + # If you installed Istio using Helm following the standard documentation, this would be "istio=ingress" + selector: + istio: ingressgateway + servers: + - port: + number: 32222 + name: http + protocol: TCP + hosts: + - ssh1.nhngpuaas.com +--- +# virtual-service.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: test + namespace: org1 +spec: + hosts: + - "ssh1.nhngpuaas.com" + gateways: + - ssh-gateway + tcp: + - match: + - port: 32222 + route: + - destination: + port: + number: 2222 + host: ssh-service diff --git a/gpuaas/nfs-provisioner/test-claim.yaml b/gpuaas/nfs-provisioner/test-claim.yaml index 5882685..4dd2867 100644 --- a/gpuaas/nfs-provisioner/test-claim.yaml +++ b/gpuaas/nfs-provisioner/test-claim.yaml @@ -4,7 +4,7 @@ metadata: name: test-claim namespace: istio-system spec: - storageClassName: nfs-client + storageClassName: user-nas accessModes: - ReadWriteMany resources: diff --git a/gpuaas/nfs-provisioner/user-sc.yaml b/gpuaas/nfs-provisioner/user-sc.yaml new file mode 100644 index 0000000..79a1034 --- /dev/null +++ b/gpuaas/nfs-provisioner/user-sc.yaml @@ -0,0 +1,9 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: user-nas +provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment's env PROVISIONER_NAME' +parameters: + archiveOnDelete: "false" + onDelete: Retain +reclaimPolicy: Retain diff --git a/gpuaas/sample_pod/tf-istio.yaml b/gpuaas/sample_pod/tf-istio.yaml new file mode 100644 index 0000000..ef8d49c --- /dev/null +++ b/gpuaas/sample_pod/tf-istio.yaml @@ -0,0 +1,110 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: tf-notebook-pvc-istio + namespace: sample-istio +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + storageClassName: nfs-client +--- +apiVersion: v1 +kind: Service +metadata: + name: tf-notebook-istio + namespace: sample-istio + labels: + app: tf-notebook-istio +spec: + type: ClusterIP + ports: + - port: 80 + name: http + targetPort: 8888 + selector: + app: tf-notebook-istio +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tf-notebook-istio + namespace: sample-istio +spec: + replicas: 1 + selector: + matchLabels: + app: tf-notebook-istio + template: + metadata: + labels: + app: tf-notebook-istio + spec: + nodeSelector: + nodegroup: gpu + containers: + - name: tf-notebook + image: tensorflow/tensorflow:2.16.2-gpu-jupyter + resources: + limits: + nvidia.com/gpu: 1 + ports: + - containerPort: 8888 + name: notebook + volumeMounts: + - name: notebook-storage + mountPath: /sample + volumes: + - name: notebook-storage + persistentVolumeClaim: + claimName: tf-notebook-pvc-istio +--- +# Gateway.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: Gateway +metadata: + name: tf-istio-gateway + namespace: sample-istio +spec: + # The selector matches the ingress gateway pod labels. + # If you installed Istio using Helm following the standard documentation, this would be "istio=ingress" + selector: + istio: ingressgateway + servers: + - port: + number: 80 + name: http + protocol: HTTP + hosts: + - tf-istio.nhngpuaas.com + tls: + httpsRedirect: true # sends 301 redirect for http requests + - port: + number: 443 + name: https + protocol: HTTPS + hosts: + - tf-istio.nhngpuaas.com + tls: + mode: SIMPLE # enables HTTPS on this port + credentialName: nhngpuaas-ssl +--- +# virtual-service.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: test + namespace: sample-istio +spec: + hosts: + - "tf-istio.nhngpuaas.com" + gateways: + - tf-istio-gateway + http: + - route: + - destination: + port: + number: 80 + host: tf-notebook-istio diff --git a/monitoring/fail.yaml b/monitoring/fail.yaml new file mode 100644 index 0000000..4273aa4 --- /dev/null +++ b/monitoring/fail.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: a1-failed-deploy + namespace: org1 +spec: + replicas: 1 + selector: + matchLabels: + app: fail-app + template: + metadata: + labels: + app: fail-app + spec: + nodeSelector: + nodegroup: gpu + containers: + - name: fail-container + image: busybox + command: ["sh", "-c", "exit 1"] # 실행하자마자 실패 + diff --git a/monitoring/pending.yaml b/monitoring/pending.yaml new file mode 100644 index 0000000..7fadc7c --- /dev/null +++ b/monitoring/pending.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: a1-pending-deploy + namespace: org1 +spec: + replicas: 1 + selector: + matchLabels: + app: pending-app + template: + metadata: + labels: + app: pending-app + spec: + nodeSelector: + nodegroup: warkj + containers: + - name: pending-container + image: busybox + command: ["sleep", "3600"] + resources: + requests: + memory: "50000Gi" # 과도한 리소스 요청으로 스케줄링 불가 + cpu: "100000" + diff --git a/monitoring/scp.sh b/monitoring/scp.sh index f59700d..7fd9e2d 100755 --- a/monitoring/scp.sh +++ b/monitoring/scp.sh @@ -2,7 +2,7 @@ # 변수 정의 NAMESPACE="org1" # 예: org1 -POD_NAME="a7-tf-notebook-5b5ddb5f7-mmlqv" # 예: tf-notebook-abcdef +POD_NAME="a7-tf-notebook-7987c576c6-d2jx8" # 예: tf-notebook-abcdef LOCAL_FILE="./unlimit.py" # 예: ./config.json TARGET_PATH="/tf" # 예: /app/config/ diff --git a/svc.yaml b/svc.yaml new file mode 100644 index 0000000..e553e4f --- /dev/null +++ b/svc.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: ssh-service +spec: + selector: + app: ssh-server + type: ClusterIP + ports: + - protocol: TCP + port: 2222 + targetPort: 2222 + diff --git a/svc2.yaml b/svc2.yaml new file mode 100644 index 0000000..a85a6b0 --- /dev/null +++ b/svc2.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: ssh-service-2 +spec: + selector: + app: ssh-server-2 + type: ClusterIP + ports: + - protocol: TCP + port: 2222 + targetPort: 2222 + diff --git a/test.yaml b/test.yaml new file mode 100644 index 0000000..bb11b62 --- /dev/null +++ b/test.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ssh-server +spec: + replicas: 1 + selector: + matchLabels: + app: ssh-server + template: + metadata: + labels: + app: ssh-server + spec: + containers: + - name: ssh-server + image: linuxserver/openssh-server + env: + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: TZ + value: "Asia/Seoul" + - name: PASSWORD_ACCESS + value: "true" + - name: USER_PASSWORD + value: "yourpassword" # 사용자 비밀번호 설정 + - name: USER_NAME + value: "testuser" # 사용자 이름 설정 + ports: + - containerPort: 2222 # ssh는 기본적으로 22번 포트지만 이 이미지는 2222 사용 + diff --git a/test2.yaml b/test2.yaml new file mode 100644 index 0000000..5d54219 --- /dev/null +++ b/test2.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ssh-server-2 +spec: + replicas: 1 + selector: + matchLabels: + app: ssh-server-2 + template: + metadata: + labels: + app: ssh-server-2 + spec: + containers: + - name: ssh-server + image: linuxserver/openssh-server + env: + - name: PUID + value: "1000" + - name: PGID + value: "1000" + - name: TZ + value: "Asia/Seoul" + - name: PASSWORD_ACCESS + value: "true" + - name: USER_PASSWORD + value: "1111" # 사용자 비밀번호 설정 + - name: USER_NAME + value: "testuser" # 사용자 이름 설정 + ports: + - containerPort: 2222 # ssh는 기본적으로 22번 포트지만 이 이미지는 2222 사용 +