Kubernetes

jupyter notebook pod 만들기

sherrylover 2023. 5. 11. 11:29
728x90
반응형

 

jupyter-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jupyter-deployment
spec:
  selector:
    matchLabels:
      app: jupyter
  replicas: 1
  template:
    metadata:
      labels:
        app: jupyter
    spec:
      containers:
        - name: jupyter
          image: <registry>/jupyter-notebook:latest
          ports:
            - containerPort: 8888

jupyter-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: jupyter-service
spec:
  selector:
    app: jupyter
  ports:
    - name: jupyter-port
      port: 8888
      targetPort: 8888
  type: ClusterIP
  
  
  --
  apiVersion: v1
kind: Endpoints
metadata:
  name: jupyter-notebook
subsets:
  - addresses:
      - ip: 10.0.0.2
    ports:
      - name: http
        port: 8888
        protocol: TCP

 

jupyter-ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: jupyter-ingress
spec:
  rules:
    - host: jupyter.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: jupyter-service
                port:
                  name: jupyter-port

 

kubectl apply -f jupyter-deployment.yaml
kubectl apply -f jupyter-service.yaml
kubectl apply -f jupyter-ingress.yaml
728x90
반응형