콘텐츠로 이동
mofcloud

Kubernetes에 MOF 배포

마지막 업데이트:

하나의 Pod에서 MOF, Dash, MCP를 실행합니다.

Linux amd64 · kubectl · 외부 PostgreSQL · 1 Pod · 컨테이너 3개

사설 네트워크 · CREATEDB 권한 필요 · TLS 전용 PostgreSQL 미지원.

이미지 소스

mof.yaml 다운로드

Docker Hub · MOF v2.0.15 · Dash v2.0.17 · MCP v2.0.3

다운로드 mof.yaml ↓
파일 보기
mof.yaml
# MOF v2.0.15 + Dash v2.0.17 + MCP v2.0.3
# Edit database address, user and password before applying. Keep this file private.
# Keep the Service names mof, mof-mcp and dash, all in one namespace: the components find each
# other by them (mof:8080, mof-mcp:8001). Renamed Services can't connect.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
apiVersion: v1
kind: Namespace
metadata:
  name: mof
---
apiVersion: v1
kind: Secret
metadata:
  name: mof-database
  namespace: mof
type: Opaque
stringData:
  password: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mof-config
  namespace: mof
data:
  RK_POSTGRES_0_ADDR: "db.example.com:5432"
  RK_POSTGRES_0_USER: "mof"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mof
  namespace: mof
spec:
  replicas: 1
  # First-release template: stop the old Pod before starting the new version.
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: mof
  template:
    metadata:
      labels:
        app: mof
      # Prometheus discovery by annotation; see the monitoring guide for a PodMonitor
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
        prometheus.io/path: /internal/v1/mof/metrics
    spec:
      enableServiceLinks: false
      nodeSelector:
        kubernetes.io/arch: amd64
      terminationGracePeriodSeconds: 120
      containers:
        - name: mof
          image: mofcloud/mof:v2.0.15
          envFrom:
            - configMapRef:
                name: mof-config
          env:
            - name: RK_POSTGRES_0_PASS
              valueFrom:
                secretKeyRef:
                  name: mof-database
                  key: password
          ports:
            - name: api
              containerPort: 8080
          startupProbe:
            httpGet:
              path: /v1/mof/site-info
              port: api
            periodSeconds: 10
            failureThreshold: 60
          readinessProbe:
            httpGet:
              path: /v1/mof/site-info
              port: api
            periodSeconds: 10
            timeoutSeconds: 5
          resources:
            requests:
              cpu: "500m"
              memory: "1Gi"
          volumeMounts:
            - name: offer-cache
              mountPath: /usr/src/mof/offer-cache
      volumes:
        - name: offer-cache
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: mof
  namespace: mof
spec:
  selector:
    app: mof
  ports:
    - name: api
      port: 8080
      targetPort: api
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mof-mcp
  namespace: mof
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mof-mcp
  template:
    metadata:
      labels:
        app: mof-mcp
    spec:
      enableServiceLinks: false
      nodeSelector:
        kubernetes.io/arch: amd64
      containers:
        - name: mof-mcp
          image: mofcloud/mof-mcp:v2.0.3
          ports:
            - name: mcp
              containerPort: 8001
          readinessProbe:
            exec:
              command: ["node", "/app/build/healthcheck.js"]
            periodSeconds: 10
            timeoutSeconds: 5
          resources:
            requests:
              cpu: "100m"
              memory: "128Mi"
---
apiVersion: v1
kind: Service
metadata:
  name: mof-mcp
  namespace: mof
spec:
  selector:
    app: mof-mcp
  ports:
    - name: mcp
      port: 8001
      targetPort: mcp
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dash
  namespace: mof
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dash
  template:
    metadata:
      labels:
        app: dash
    spec:
      enableServiceLinks: false
      nodeSelector:
        kubernetes.io/arch: amd64
      containers:
        - name: dash
          image: mofcloud/dash:v2.0.17
          ports:
            - name: web
              containerPort: 80
          readinessProbe:
            httpGet:
              path: /
              port: web
            periodSeconds: 10
          resources:
            requests:
              cpu: "100m"
              memory: "64Mi"
---
apiVersion: v1
kind: Service
metadata:
  name: dash
  namespace: mof
spec:
  selector:
    app: dash
  ports:
    - name: web
      port: 80
      targetPort: web
  type: ClusterIP

Service 이름 mof, mof-mcp, dash는 그대로 두고 모두 같은 네임스페이스에 두세요. 구성 요소는 이 이름(mof:8080, mof-mcp:8001)으로 서로를 찾으므로 별도 설정이 필요 없습니다. 이름을 바꾸면 연결되지 않습니다.

데이터베이스 연결

mof.yaml에 기존 PostgreSQL 정보를 입력합니다:

RK_POSTGRES_0_ADDR
주소:포트
RK_POSTGRES_0_USER
사용자 이름
stringData.password
기존 데이터베이스 비밀번호

비밀번호는 따옴표로 감싼 채 두고, 이 파일은 비공개로 유지하세요.

배포

Terminal
kubectl apply -f mof.yaml
kubectl -n mof rollout status deployment/mof --timeout=10m
kubectl -n mof rollout status deployment/mof-mcp deployment/dash

세 개 모두 롤아웃되면 Admin 비밀번호를 확인합니다:

Terminal
kubectl -n mof logs deployment/mof | grep "Admin password"

MOF 열기

Terminal
kubectl -n mof port-forward service/dash 8000:80

이 터미널은 계속 실행해 두세요.

Adminhttp://127.0.0.1:8000/admin

라이선스를 설치하고 사용자를 만듭니다.

MOF Webhttp://127.0.0.1:8000

MOF 계정으로 로그인합니다.

고급 설정

PostgreSQL TLS 호환성

MOF Mof와 AsyncJobMof에는 TLS 설정을 적용하지만 제공업체 데이터베이스에는 적용하지 않습니다. 이 템플릿은 신뢰할 수 있는 사설 네트워크가 필요하며 TLS 전용 PostgreSQL은 사용할 수 없습니다.

도메인, HTTPS 및 선택적 OAuth

기존 Ingress 컨트롤러를 사용하고 도메인이 이를 가리키도록 하세요. mof 네임스페이스에 class, 호스트 이름, 기존 TLS Secret을 설정합니다.

다운로드 ingress.yaml ↓
ingress.yaml
# Requires an installed Ingress controller and an existing TLS Secret.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: mof
  namespace: mof
spec:
  ingressClassName: nginx
  tls:
    - hosts: [mof.example.com]
      secretName: mof-web-tls
  rules:
    - host: mof.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: dash
                port:
                  number: 80
Terminal
kubectl apply -f ingress.yaml
kubectl -n mof get ingress

Admin → 설정 → MCP에서 MCP를 활성화하세요. 엔드포인트: /v1/mof/remote-mcp. 토큰에는 OAuth가 필요 없으며, 브라우저 OAuth에는 HTTPS, MOF_PUBLIC_URL, MOF_MCP_OAUTH_SECRET이 필요합니다.

헬스 체크와 문제 해결
Terminal
kubectl -n mof get pods
kubectl -n mof logs deployment/mof --tail=100
kubectl -n mof logs deployment/mof-mcp --tail=60
kubectl -n mof logs deployment/dash --tail=60
kubectl -n mof exec deployment/mof -- wget -q -O - http://mof-mcp:8001/health

정상 상태: mof, mof-mcp, dash가 Running 및 Ready, MCP ready: true. 시작에 실패하면 이미지 풀, 노드 아키텍처, 데이터베이스 접근을 확인하세요.

템플릿 매개변수
RK_POSTGRES_0_ADDR외부 PostgreSQL hostname:port. Pod에서 접근할 수 있어야 합니다.
RK_POSTGRES_0_USERMOF 및 제공업체 데이터베이스를 생성할 권한이 있는 기존 데이터베이스 역할.
mof-database / passwordSecret에 저장된 데이터베이스 비밀번호. MOF에만 주입됩니다.
Services mof / mof-mcp / dashDeployment와 Service가 각각 하나씩. Service 이름으로 서로를 찾으므로 설정할 것이 없습니다.
replicas / strategy1 / Recreate. 업그레이드 시 서비스가 잠시 중단됩니다. 다중 레플리카 고가용성은 이 템플릿의 범위가 아닙니다.
resources.requests스케줄링 예약량이며 메모리 상한이 아닙니다. 청구서 규모에 맞게 MOF 리소스를 조정하고 실제 사용량을 모니터링하세요.
offer-cache / emptyDir다시 만들 수 있는 공개 가격 캐시. Pod가 교체되면 사라지지만, 청구 데이터는 PostgreSQL에 남습니다.
ingressClassName / host / tls설치된 컨트롤러, 공개 도메인, TLS Secret에 맞게 설정하세요. 로컬 포트 포워딩으로 확인할 때는 필요 없습니다.
업데이트, 데이터, 확장

PostgreSQL을 백업하고 이미지 버전을 업데이트한 뒤 mof.yaml을 적용합니다. ConfigMap이나 Secret을 바꾼 뒤에는 재시작하세요. Recreate 업그레이드는 서비스를 중단시킵니다.

Terminal
kubectl -n mof rollout restart deployment/mof
kubectl -n mof rollout status deployment/mof --timeout=10m

단일 레플리카만 지원하며, 온디맨드 Kubernetes Job은 구현되어 있지 않습니다. 애플리케이션 데이터는 외부 PostgreSQL에 남고, 가격 캐시는 다시 만들 수 있습니다.