This commit is contained in:
parent
bdc3c9264b
commit
61896464c4
22
gateway.yaml
22
gateway.yaml
|
|
@ -1,38 +1,36 @@
|
||||||
# Gateway.yaml
|
|
||||||
apiVersion: networking.istio.io/v1alpha3
|
apiVersion: networking.istio.io/v1alpha3
|
||||||
kind: Gateway
|
kind: Gateway
|
||||||
metadata:
|
metadata:
|
||||||
name: ssh2-gateway
|
name: ssh2-gateway
|
||||||
namespace: default
|
namespace: org1
|
||||||
spec:
|
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:
|
selector:
|
||||||
istio: ingressgateway
|
istio: ingressgateway
|
||||||
servers:
|
servers:
|
||||||
- port:
|
- port:
|
||||||
number: 80
|
number: 30333
|
||||||
name: http
|
name: tcp-30333
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
hosts:
|
hosts:
|
||||||
- ssh2.nhngpuaas.com
|
- proxy.gpulive.nhncloud.com
|
||||||
---
|
---
|
||||||
# virtual-service.yaml
|
|
||||||
apiVersion: networking.istio.io/v1alpha3
|
apiVersion: networking.istio.io/v1alpha3
|
||||||
kind: VirtualService
|
kind: VirtualService
|
||||||
metadata:
|
metadata:
|
||||||
name: test-2
|
name: test-2
|
||||||
namespace: default
|
namespace: org1
|
||||||
spec:
|
spec:
|
||||||
hosts:
|
hosts:
|
||||||
- "ssh2.nhngpuaas.com"
|
- "proxy.gpulive.nhncloud.com"
|
||||||
gateways:
|
gateways:
|
||||||
- ssh2-gateway
|
- ssh2-gateway
|
||||||
tcp:
|
tcp:
|
||||||
- match:
|
- match:
|
||||||
- port: 8080
|
- port: 30333
|
||||||
route:
|
route:
|
||||||
- destination:
|
- destination:
|
||||||
|
host: ssh-service
|
||||||
port:
|
port:
|
||||||
number: 2222
|
number: 2222
|
||||||
host: ssh-service-2
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -9,25 +9,25 @@ spec:
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 1Gi
|
storage: 1Gi
|
||||||
storageClassName: nfs-client
|
storageClassName: user-nas
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: tf-notebook
|
name: tf-notebook
|
||||||
labels:
|
labels:
|
||||||
user: user3
|
workload-name: customer7
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: tf-notebook
|
app: tf-notebook
|
||||||
user: user3
|
workload-name: customer7
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: tf-notebook
|
app: tf-notebook
|
||||||
user: user3
|
workload-name: customer7
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
nodegroup: gpu
|
nodegroup: gpu
|
||||||
|
|
@ -56,7 +56,7 @@ metadata:
|
||||||
name: tf-notebook
|
name: tf-notebook
|
||||||
labels:
|
labels:
|
||||||
app: tf-notebook
|
app: tf-notebook
|
||||||
user: user3
|
workload-name: customer7
|
||||||
spec:
|
spec:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
ports:
|
ports:
|
||||||
|
|
@ -65,4 +65,4 @@ spec:
|
||||||
targetPort: 8888
|
targetPort: 8888
|
||||||
selector:
|
selector:
|
||||||
app: tf-notebook
|
app: tf-notebook
|
||||||
user: user3
|
workload-name: customer7
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
@ -8,10 +8,12 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: fail-app
|
app: fail-app
|
||||||
|
workload-name: fail-customer
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: fail-app
|
app: fail-app
|
||||||
|
workload-name: fail-customer
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
nodegroup: gpu
|
nodegroup: gpu
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
@ -8,10 +8,12 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: pending-app
|
app: pending-app
|
||||||
|
workload-name: pending-customer
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: pending-app
|
app: pending-app
|
||||||
|
workload-name: pending-customer
|
||||||
spec:
|
spec:
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
nodegroup: warkj
|
nodegroup: warkj
|
||||||
|
|
|
||||||
13
svc2.yaml
13
svc2.yaml
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
@ -25,9 +25,9 @@ spec:
|
||||||
- name: PASSWORD_ACCESS
|
- name: PASSWORD_ACCESS
|
||||||
value: "true"
|
value: "true"
|
||||||
- name: USER_PASSWORD
|
- name: USER_PASSWORD
|
||||||
value: "yourpassword" # 사용자 비밀번호 설정
|
value: "test" # 사용자 비밀번호 설정
|
||||||
- name: USER_NAME
|
- name: USER_NAME
|
||||||
value: "testuser" # 사용자 이름 설정
|
value: "test" # 사용자 이름 설정
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 2222 # ssh는 기본적으로 22번 포트지만 이 이미지는 2222 사용
|
- containerPort: 2222 # ssh는 기본적으로 22번 포트지만 이 이미지는 2222 사용
|
||||||
|
|
||||||
|
|
|
||||||
33
test2.yaml
33
test2.yaml
|
|
@ -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 사용
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue