diff --git a/gateway.yaml b/gateway.yaml index a8b85de..4364bf5 100644 --- a/gateway.yaml +++ b/gateway.yaml @@ -1,38 +1,36 @@ -# Gateway.yaml apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: ssh2-gateway - namespace: default + 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: 80 - name: http + number: 30333 + name: tcp-30333 protocol: TCP hosts: - - ssh2.nhngpuaas.com + - proxy.gpulive.nhncloud.com --- -# virtual-service.yaml apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: test-2 - namespace: default + namespace: org1 spec: hosts: - - "ssh2.nhngpuaas.com" + - "proxy.gpulive.nhncloud.com" gateways: - ssh2-gateway tcp: - match: - - port: 8080 + - port: 30333 route: - destination: + host: ssh-service port: number: 2222 - host: ssh-service-2 + + diff --git a/gateway2.yaml b/gateway2.yaml deleted file mode 100644 index a134e18..0000000 --- a/gateway2.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# 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/gpulive/grafana/base/grafana/test-vs.yaml b/gpulive/grafana/base/grafana/test-vs.yaml new file mode 100644 index 0000000..9c44a85 --- /dev/null +++ b/gpulive/grafana/base/grafana/test-vs.yaml @@ -0,0 +1,18 @@ +# virtual-service.yaml +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: grafana-vs + namespace: grafana +spec: + hosts: + - "monitoring.gpulive.nhncloud.com" + gateways: + - istio-system/workload-proxy-gateway + http: + - route: + - destination: + port: + number: 80 + host: grafana + diff --git a/gpulive/harbor_2.9.1/vm/3_apply/test-vs.yaml b/gpulive/harbor_2.9.1/vm/3_apply/test-vs.yaml new file mode 100644 index 0000000..b8d24e1 --- /dev/null +++ b/gpulive/harbor_2.9.1/vm/3_apply/test-vs.yaml @@ -0,0 +1,39 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: harbor-virtualservice + namespace: harbor +spec: + hosts: + - registry.gpulive.nhncloud.com + gateways: + - istio-system/workload-proxy-gateway + http: + - match: + - uri: + exact: /v2/ + - uri: + prefix: /v2/ + - uri: + prefix: /api/ + - uri: + prefix: /service/ + - uri: + prefix: /chartrepo/ + - uri: + prefix: /c/ + route: + - destination: + host: harbor-core.harbor.svc.cluster.local + port: + number: 80 + - match: + - uri: + exact: / + - uri: + prefix: / + route: + - destination: + host: harbor-portal.harbor.svc.cluster.local + port: + number: 80 diff --git a/gpulive/jupyter_kustomize/base/tf.yaml b/gpulive/jupyter_kustomize/base/tf.yaml index 0544160..3f40f3f 100644 --- a/gpulive/jupyter_kustomize/base/tf.yaml +++ b/gpulive/jupyter_kustomize/base/tf.yaml @@ -9,25 +9,25 @@ spec: resources: requests: storage: 1Gi - storageClassName: nfs-client + storageClassName: user-nas --- apiVersion: apps/v1 kind: Deployment metadata: name: tf-notebook labels: - user: user3 + workload-name: customer7 spec: replicas: 1 selector: matchLabels: app: tf-notebook - user: user3 + workload-name: customer7 template: metadata: labels: app: tf-notebook - user: user3 + workload-name: customer7 spec: nodeSelector: nodegroup: gpu @@ -56,7 +56,7 @@ metadata: name: tf-notebook labels: app: tf-notebook - user: user3 + workload-name: customer7 spec: type: ClusterIP ports: @@ -65,4 +65,4 @@ spec: targetPort: 8888 selector: app: tf-notebook - user: user3 + workload-name: customer7 diff --git a/gpulive/prometheus/kube_state.yaml b/gpulive/prometheus/kube_state.yaml new file mode 100644 index 0000000..fdb4e21 --- /dev/null +++ b/gpulive/prometheus/kube_state.yaml @@ -0,0 +1,94 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: prometheus-kube-state-metrics + namespace: monitoring + labels: + helm.sh/chart: kube-state-metrics-5.28.1 + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: kube-state-metrics + app.kubernetes.io/name: kube-state-metrics + app.kubernetes.io/instance: prometheus + app.kubernetes.io/version: "2.14.0" +spec: + selector: + matchLabels: + app.kubernetes.io/name: kube-state-metrics + app.kubernetes.io/instance: prometheus + replicas: 1 + strategy: + type: RollingUpdate + revisionHistoryLimit: 10 + template: + metadata: + labels: + helm.sh/chart: kube-state-metrics-5.28.1 + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: kube-state-metrics + app.kubernetes.io/name: kube-state-metrics + app.kubernetes.io/instance: prometheus + app.kubernetes.io/version: "2.14.0" + spec: + nodeSelector: + nodegroup: nd + automountServiceAccountToken: true + hostNetwork: false + serviceAccountName: prometheus-kube-state-metrics + securityContext: + fsGroup: 65534 + runAsGroup: 65534 + runAsNonRoot: true + runAsUser: 65534 + seccompProfile: + type: RuntimeDefault + containers: + - name: kube-state-metrics + args: + - --port=8080 + - --resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments + - --metric-labels-allowlist=pods=[workload-name] + - --metric-labels-allowlist=nodes=[nodegroup] + - --metric-labels-allowlist=namespaces=[project-name] + imagePullPolicy: Always + image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.14.0 + ports: + - containerPort: 8080 + name: "http" + livenessProbe: + failureThreshold: 3 + httpGet: + httpHeaders: + path: /livez + port: 8080 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + readinessProbe: + failureThreshold: 3 + httpGet: + httpHeaders: + path: /readyz + port: 8081 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + resources: + requests: + cpu: 50m + memory: 125Mi + limits: + cpu: 100m + memory: 250Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + diff --git a/monitoring/fail.yaml b/monitoring/fail.yaml index 4273aa4..216d625 100644 --- a/monitoring/fail.yaml +++ b/monitoring/fail.yaml @@ -8,10 +8,12 @@ spec: selector: matchLabels: app: fail-app + workload-name: fail-customer template: metadata: labels: app: fail-app + workload-name: fail-customer spec: nodeSelector: nodegroup: gpu diff --git a/monitoring/multi.py b/monitoring/multi.py new file mode 100644 index 0000000..20a9eff --- /dev/null +++ b/monitoring/multi.py @@ -0,0 +1,52 @@ +import tensorflow as tf +from tensorflow.keras import layers, models +import numpy as np +import time + +start_time = time.time() +# 변수 정의 + +# 사용 가능한 GPU 확인 +gpus = tf.config.list_physical_devices('GPU') +print("Available GPUs:", gpus) + +for gpu in gpus: + tf.config.experimental.set_memory_growth(gpu, True) +# 데이터셋 로드 및 전처리 +(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() + +# 데이터 정규화 및 차원 확장 +x_train = x_train / 255.0 +x_test = x_test / 255.0 +x_train = np.expand_dims(x_train, -1) +x_test = np.expand_dims(x_test, -1) + +# 간단한 CNN 모델 정의 +model = models.Sequential([ + layers.Conv2D(32, (3, 3), activation='relu', input_shape=(28, 28, 1)), + layers.MaxPooling2D((2, 2)), + layers.Conv2D(64, (3, 3), activation='relu'), + layers.MaxPooling2D((2, 2)), + layers.Flatten(), + layers.Dense(64, activation='relu'), + layers.Dense(10, activation='softmax') +]) + +# 모델 컴파일 +model.compile(optimizer='adam', + loss='sparse_categorical_crossentropy', + metrics=['accuracy']) + +# 모델 요약 +model.summary() + +# 모델 훈련 +model.fit(x_train, y_train, epochs=500, batch_size=256, validation_split=0.2) + +# 모델 평가 +test_loss, test_acc = model.evaluate(x_test, y_test, verbose=2) +print(f"Test accuracy: {test_acc:.2f}") + +# 모델 평가 종료 시간 기록 및 출력 +end_time = time.time() +print(f"Evaluation time: {end_time - start_time:.2f} seconds") diff --git a/monitoring/pending.yaml b/monitoring/pending.yaml index 7fadc7c..275fe66 100644 --- a/monitoring/pending.yaml +++ b/monitoring/pending.yaml @@ -8,10 +8,12 @@ spec: selector: matchLabels: app: pending-app + workload-name: pending-customer template: metadata: labels: app: pending-app + workload-name: pending-customer spec: nodeSelector: nodegroup: warkj diff --git a/svc2.yaml b/svc2.yaml deleted file mode 100644 index a85a6b0..0000000 --- a/svc2.yaml +++ /dev/null @@ -1,13 +0,0 @@ -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 index bb11b62..3e7e01a 100644 --- a/test.yaml +++ b/test.yaml @@ -25,9 +25,9 @@ spec: - name: PASSWORD_ACCESS value: "true" - name: USER_PASSWORD - value: "yourpassword" # 사용자 비밀번호 설정 + value: "test" # 사용자 비밀번호 설정 - name: USER_NAME - value: "testuser" # 사용자 이름 설정 + value: "test" # 사용자 이름 설정 ports: - containerPort: 2222 # ssh는 기본적으로 22번 포트지만 이 이미지는 2222 사용 diff --git a/test2.yaml b/test2.yaml deleted file mode 100644 index 5d54219..0000000 --- a/test2.yaml +++ /dev/null @@ -1,33 +0,0 @@ -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 사용 -