This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: fastapi-deployment | |
| namespace: default | |
| spec: | |
| replicas: 3 | |
| selector: | |
| matchLabels: | |
| app: fastapi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # terraform/eks.tf | |
| # EKS 클러스터 모듈 | |
| module "eks" { | |
| source = "terraform-aws-modules/eks/aws" | |
| version = "~> 19.0" | |
| cluster_name = var.cluster_name | |
| cluster_version = var.cluster_version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # terraform/vpc.tf | |
| module "vpc" { | |
| source = "terraform-aws-modules/vpc/aws" | |
| version = "~> 5.0" | |
| name = "${var.cluster_name}-vpc" | |
| cidr = "10.0.0.0/16" | |
| # 사용할 AZ 2개 선택 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 # apps/v1 (소문자 v1) | |
| kind: Deployment | |
| metadata: | |
| name: fastapi-deployment # Deployment 이름 | |
| spec: # spec (S 소문자) | |
| replicas: 2 # 파드 2개 실행 | |
| selector: | |
| matchLabels: | |
| app: fastapi # 파드를 선택하는 label selector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Python 캐시/컴파일 파일 | |
| __pycache__/ | |
| *.pyc | |
| *.pyo | |
| *.pyd | |
| # 가상환경 | |
| venv/ | |
| .env | |
| .Python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| import os | |
| app = FastAPI( | |
| title="FastAPI on EKS", | |
| description="Simple API for K8s deployment", | |
| version="1.0.0" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # helm.tf | |
| # Helm provider 설정 및 helm_release 리소스 정의 | |
| provider "helm" { | |
| kubernetes { | |
| config_path = "~/.kube/config" | |
| } | |
| } | |
| # Prometheus Stack Helm Release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # helm.tf | |
| # Helm provider 설정 및 helm_release 리소스 정의 | |
| provider "helm" { | |
| kubernetes { | |
| config_path = "~/.kube/config" | |
| } | |
| } | |
| # Prometheus Stack Helm Release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ExternalName Service for apps namespace services | |
| # This allows default namespace to access apps namespace services | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: fastapi-app-external | |
| namespace: default | |
| spec: | |
| type: ExternalName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ExternalName Service for monitoring namespace services | |
| # This allows default namespace to access monitoring namespace services | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: grafana-external | |
| namespace: default | |
| spec: | |
| type: ExternalName |
NewerOlder