{"id":28441524,"url":"https://github.com/flexyzwork/pulumi-python-oke-single","last_synced_at":"2026-04-29T15:05:06.838Z","repository":{"id":296959823,"uuid":"994518920","full_name":"flexyzwork/pulumi-python-oke-single","owner":"flexyzwork","description":"Pulumi-based Infrastructure as Code for Oracle Kubernetes Engine (OKE) on OCI. Automate cluster creation, reduce deployment time, and manage Kubernetes infrastructure.","archived":false,"fork":false,"pushed_at":"2025-06-03T09:07:10.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-03T16:24:08.761Z","etag":null,"topics":["automation","devops","iac","oci","oke","pulumi","pulumi-python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flexyzwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-02T04:15:40.000Z","updated_at":"2025-06-03T09:07:11.000Z","dependencies_parsed_at":"2025-06-08T02:16:16.855Z","dependency_job_id":null,"html_url":"https://github.com/flexyzwork/pulumi-python-oke-single","commit_stats":null,"previous_names":["flexyzwork/pulumi-python-oke-single"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flexyzwork/pulumi-python-oke-single","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexyzwork%2Fpulumi-python-oke-single","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexyzwork%2Fpulumi-python-oke-single/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexyzwork%2Fpulumi-python-oke-single/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexyzwork%2Fpulumi-python-oke-single/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flexyzwork","download_url":"https://codeload.github.com/flexyzwork/pulumi-python-oke-single/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexyzwork%2Fpulumi-python-oke-single/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32430807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","devops","iac","oci","oke","pulumi","pulumi-python"],"created_at":"2025-06-06T05:00:17.318Z","updated_at":"2026-04-29T15:05:06.833Z","avatar_url":"https://github.com/flexyzwork.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pulumi를 사용한 OCI OKE 관리 가이드\n\n이 문서는 Pulumi를 사용하여 Oracle Cloud Infrastructure(OCI)에서 Oracle Kubernetes Engine(OKE) 클러스터를 생성하고, Cluster API를 통해 전체 인프라를 관리하는 방법을 설명합니다.\n\n## 🎯 왜 만들었나요?\n\n### 기존 문제점\n- **수동 관리의 한계**: 웹 콘솔을 통한 수동 인프라 관리로 인한 실수와 일관성 부족\n- **환경 간 불일치**: 개발, 스테이징, 프로덕션 환경 간의 설정 차이\n- **복잡한 멀티 클러스터 관리**: 여러 Kubernetes 클러스터의 생명주기 관리 복잡성\n\n### 해결 방안\n- **Infrastructure as Code**: 모든 인프라를 코드로 정의하여 버전 관리 및 재현 가능한 배포\n- **자동화된 워크플로우**: Pulumi + Cluster API를 통한 선언적 인프라 관리\n- **표준화된 환경**: 동일한 템플릿으로 일관된 클러스터 환경 제공\n\n### 기대 효과\n```\n시간 단축: 클러스터 생성 4-6시간 → 15-30분\n운영 효율: 수동 작업 최소화 및 자동화된 장애 복구\n비용 절감: 리소스 최적화 및 운영 인력 절약\n```\n\n## 시스템 아키텍처 다이어그램\n![시스템 아키텍처 다이어그램](./images/kr.svg)\n\n\n## 📋 목차\n\n1. [사전 준비](#사전-준비)\n2. [Pulumi 설치 및 설정](#pulumi-설치-및-설정)\n3. [OCI CLI 설정](#oci-cli-설정)\n4. [Python 환경 설정](#python-환경-설정)\n5. [Pulumi 스택 설정](#pulumi-스택-설정)\n6. [인프라 배포](#인프라-배포)\n7. [문제 해결](#문제-해결)\n\n## 🚀 사전 준비\n\n### 시스템 요구사항\n- macOS/Linux/Windows\n- Python 3.8 이상\n- Node.js 14 이상\n- Docker (선택사항)\n\n### 필요한 도구\n- Pulumi CLI\n- OCI CLI\n- kubectl\n- Python 가상환경 (venv)\n\n## 🔧 Pulumi 설치 및 설정\n\n### 1. Pulumi 설치\n\n```bash\n# macOS (Homebrew 사용)\nbrew install pulumi/tap/pulumi\n\n# Linux\ncurl -fsSL https://get.pulumi.com | sh\n\n# Windows (Chocolatey 사용)\nchoco install pulumi\n```\n\n### 2. Pulumi 조직 설정 (선택사항)\n\n```bash\n# 기본 조직 설정\npulumi org set-default \u003cyour-organization-name\u003e\n```\n\n### 3. Terraform에서 Pulumi로 변환 (기존 Terraform 코드가 있는 경우)\n\n```bash\n# Terraform을 Pulumi Python 코드로 변환\npulumi convert --from terraform --language python\n```\n\n\u003e ⚠️ **주의**: 이 명령어는 `pulumi new python`과 유사한 효과를 발생시켜 기존 파일(`__main__.py`, `.gitignore` 등)을 덮어쓸 수 있습니다.\n\n## 🌩️ OCI CLI 설정\n\n### 1. OCI CLI 설치\n\n```bash\n# macOS (Homebrew 사용)\nbrew install oci-cli\n\n# Linux/Windows\nbash -c \"$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)\"\n```\n\n### 2. OCI 설정 파일 구성\n\n```bash\n# OCI 설정 초기화\noci setup config\n\n# 설정 파일 확인\ncat ~/.oci/config\n```\n\n### 3. OCI 프로필 설정\n\n```bash\n# 기본 프로필을 'os'로 변경\nvi ~/.oci/oci_cli_rc\n```\n\n**oci_cli_rc 파일 내용:**\n```ini\n[OCI_CLI_SETTINGS]\ndefault_profile=os\n```\n\n### 4. OCI 연결 확인\n\n```bash\n# 프로필 변경 확인\necho $OCI_CLI_PROFILE\n\n# 사용자 정보 확인\noci iam user get --user-id $(oci iam user list --query \"data[?\\\"lifecycle-state\\\"=='ACTIVE'].id | [0]\" --raw-output)\n\n# 세션 유효성 검증\noci session validate\n```\n\n## 🐍 Python 환경 설정\n\n### 1. 가상환경 생성 및 활성화\n\n```bash\n# make를 사용한 가상환경 생성 및 활성화\nmake venv\n\n# 또는\n\n# 가상환경 생성\npython -m venv venv\n\n# 가상환경 활성화 (macOS/Linux)\nsource venv/bin/activate\n\n# 가상환경 활성화 (Windows)\nvenv\\Scripts\\activate\n```\n\n### 2. 의존성 설치\n\n```bash\n# Make를 사용한 설치\nmake install\n```\n\n### 3. VS Code Python 인터프리터 설정\n\n1. `Cmd + Shift + P` (macOS) 또는 `Ctrl + Shift + P` (Windows/Linux)\n2. `Python: Select Interpreter` 선택\n3. `venv` 환경 선택\n\n## 📦 Pulumi 스택 설정\n\n### 1. 새로운 스택 생성\n\n```bash\n# 프로덕션 스택 초기화\npulumi stack init prod\n```\n\n### 2. 구성 값 설정\n\n```bash\nchmod +x ./setup_config.sh\n./setup_config.sh\n```\n\n\u003e 📝 **참고**: 이 스크립트를 실행하면 `Pulumi.prod.yaml` 파일에 설정값이 저장됩니다.\n\n### 3. 스택 관리\n\n```bash\n# 모든 스택 확인\npulumi stack ls -a\n\n# 스택 삭제 (필요한 경우)\npulumi stack rm prod\n```\n\n## 🚀 인프라 배포\n\n### 1. 인프라 배포 실행\n\n```bash\n# 모든 리소스 배포\nmake up\n\n# 또는 직접 Pulumi 명령 사용\npulumi up\n```\n\n### 2. 배포 상태 확인\n\n```bash\n# 스택 상태 확인\npulumi stack\n\n# 출력 값 확인\npulumi stack output\n\n# 리소스 상태 확인\npulumi stack export\n```\n\n### 3. kubeconfig 설정\n\n```bash\n# OKE 클러스터의 kubeconfig 획득\noci ce cluster create-kubeconfig \\\n    --cluster-id $(pulumi stack output cluster_id) \\\n    --file ~/.kube/config \\\n    --region ap-osaka-1 \\\n    --token-version 2.0.0\n\n# kubectl 연결 확인\nkubectl get nodes\n```\n\n## 📊 모니터링 및 로깅\n\n### 1. 클러스터 상태 모니터링\n\n```bash\n# OKE 클러스터 상태 확인\noci ce cluster get --cluster-id $(pulumi stack output cluster_id)\n\n# 노드 풀 상태 확인\noci ce node-pool get --node-pool-id $(pulumi stack output node_pool_id)\n```\n\n### 2. 로그 확인\n\n```bash\n# Pulumi 로그 확인\npulumi logs\n\n# OCI 감사 로그 확인 (웹 콘솔)\n# OCI Console \u003e Governance \u0026 Administration \u003e Audit\n```\n\n## 🧹 리소스 정리\n\n### 1. 인프라 삭제\n\n```bash\n# 모든 리소스 삭제\npulumi destroy\n\n# 확인 후 실행\npulumi destroy --yes\n```\n\n### 2. 스택 삭제\n\n```bash\n# 스택 삭제\npulumi stack rm dev\n```\n\n## 🛠️ 문제 해결\n\n### 1. 일반적인 문제\n\n#### OCI 인증 문제\n```bash\n# OCI 설정 확인\noci setup repair-file-permissions --file ~/.oci/config\noci setup repair-file-permissions --file ~/.oci/oci_api_key.pem\n```\n\n#### Pulumi 상태 문제\n```bash\n# 상태 새로고침\npulumi refresh\n\n# 상태 복구\npulumi stack import\n```\n\n#### Kubernetes 연결 문제\n```bash\n# kubeconfig 재생성\noci ce cluster create-kubeconfig \\\n    --cluster-id \u003ccluster-id\u003e \\\n    --file ~/.kube/config \\\n    --region ap-osaka-1 \\\n    --overwrite\n```\n\n### 2. 디버깅\n\n```bash\n# Pulumi 디버그 모드\npulumi up --debug\n\n```\n\n## 📚 참고 자료\n\n- [Pulumi Kubernetes Provider](https://www.pulumi.com/registry/packages/kubernetes/)\n- [Pulumi OCI Provider](https://www.pulumi.com/registry/packages/oci/)\n- [OCI Container Engine for Kubernetes](https://docs.oracle.com/en-us/iaas/Content/ContEng/home.htm)\n- [OCI CLI 공식 문서](https://docs.oracle.com/en-us/iaas/tools/oci-cli/3.43.1/oci_cli_docs/)\n\n## 📝 라이선스\n\n이 프로젝트는 MIT 라이선스를 따릅니다.\n\n## 🤝 기여\n\n버그 리포트, 기능 요청, 풀 리퀘스트는 언제든지 환영합니다!\n\n---\n\n**작성자**: Flexyz \\\n**이메일**: contact@flexyz.work \\\n**깃헙**: https://github.com/flexyzwork \\\n**웹사이트**: https://flexyz.work \\\n**최종 업데이트**: 2025년 6월 2일 \\\n**버전**: 1.0.0\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n\n\n---\n\n\n# Pulumi OCI OKE Management Guide\n\nThis document explains how to create Oracle Kubernetes Engine (OKE) clusters on Oracle Cloud Infrastructure (OCI) using Pulumi and manage the entire infrastructure through Cluster API.\n\n## 🎯 Why We Built This\n\n### Existing Problems\n- **Manual Management Limitations**: Errors and lack of consistency due to manual infrastructure management through web console\n- **Environment Inconsistency**: Configuration differences between development, staging, and production environments\n- **Complex Multi-Cluster Management**: Complexity in managing the lifecycle of multiple Kubernetes clusters\n\n### Solution\n- **Infrastructure as Code**: Define all infrastructure as code for version control and reproducible deployments\n- **Automated Workflows**: Declarative infrastructure management through Pulumi + Cluster API\n- **Standardized Environments**: Consistent cluster environments using identical templates\n\n### Expected Benefits\n```\nTime Reduction: Cluster creation 4-6 hours → 15-30 minutes\nOperational Efficiency: Minimize manual work and automated failure recovery\nCost Savings: Resource optimization and operational workforce reduction\n```\n\n## System Architecture Diagram\n![System Architecture Diagram](./images/en.svg)\n\n\n## 📋 Table of Contents\n\n1. [Prerequisites](#prerequisites)\n2. [Pulumi Installation and Setup](#pulumi-installation-and-setup)\n3. [OCI CLI Setup](#oci-cli-setup)\n4. [Python Environment Setup](#python-environment-setup)\n5. [Pulumi Stack Configuration](#pulumi-stack-configuration)\n6. [Infrastructure Deployment](#infrastructure-deployment)\n7. [Troubleshooting](#troubleshooting)\n\n## 🚀 Prerequisites\n\n### System Requirements\n- macOS/Linux/Windows\n- Python 3.8 or higher\n- Node.js 14 or higher\n- Docker (optional)\n\n### Required Tools\n- Pulumi CLI\n- OCI CLI\n- kubectl\n- Python virtual environment (venv)\n\n## 🔧 Pulumi Installation and Setup\n\n### 1. Install Pulumi\n\n```bash\n# macOS (using Homebrew)\nbrew install pulumi/tap/pulumi\n\n# Linux\ncurl -fsSL https://get.pulumi.com | sh\n\n# Windows (using Chocolatey)\nchoco install pulumi\n```\n\n### 2. Pulumi Organization Setup (Optional)\n\n```bash\n# Set default organization\npulumi org set-default codelab-kr\n```\n\n### 3. Convert from Terraform to Pulumi (if you have existing Terraform code)\n\n```bash\n# Convert Terraform to Pulumi Python code\npulumi convert --from terraform --language python\n```\n\n\u003e ⚠️ **Warning**: This command has a similar effect to `pulumi new python` and may overwrite existing files (`__main__.py`, `.gitignore`, etc.).\n\n## 🌩️ OCI CLI Setup\n\n### 1. Install OCI CLI\n\n```bash\n# macOS (using Homebrew)\nbrew install oci-cli\n\n# Linux/Windows\nbash -c \"$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)\"\n```\n\n### 2. Configure OCI Configuration File\n\n```bash\n# Initialize OCI configuration\noci setup config\n\n# Check configuration file\ncat ~/.oci/config\n```\n\n### 3. Set OCI Profile\n\n```bash\n# Change default profile to 'os'\nvi ~/.oci/oci_cli_rc\n```\n\n**oci_cli_rc file content:**\n```ini\n[OCI_CLI_SETTINGS]\ndefault_profile=os\n```\n\n### 4. Verify OCI Connection\n\n```bash\n# Check profile change\necho $OCI_CLI_PROFILE\n\n# Check user information\noci iam user get --user-id $(oci iam user list --query \"data[?\\\"lifecycle-state\\\"=='ACTIVE'].id | [0]\" --raw-output)\n\n# Validate session\noci session validate\n```\n\n## 🐍 Python Environment Setup\n\n### 1. Create and Activate Virtual Environment\n\n```bash\n# Create and activate virtual environment using make\nmake venv\n\n# Or manually\n\n# Create virtual environment\npython -m venv venv\n\n# Activate virtual environment (macOS/Linux)\nsource venv/bin/activate\n\n# Activate virtual environment (Windows)\nvenv\\Scripts\\activate\n```\n\n### 2. Install Dependencies\n\n```bash\n# Install using Make\nmake install\n```\n\n### 3. VS Code Python Interpreter Setup\n\n1. Press `Cmd + Shift + P` (macOS) or `Ctrl + Shift + P` (Windows/Linux)\n2. Select `Python: Select Interpreter`\n3. Choose the `venv` environment\n\n## 📦 Pulumi Stack Configuration\n\n### 1. Create New Stack\n\n```bash\n# Initialize production stack\npulumi stack init prod\n```\n\n### 2. Set Configuration Values\n\n```bash\nchmod +x ./setup_config.sh\n./setup_config.sh\n```\n\n\u003e 📝 **Note**: These settings are stored in the `Pulumi.prod.yaml` file.\n\n### 3. Stack Management\n\n```bash\n# Check all stacks\npulumi stack ls -a\n\n# Delete stack (if needed)\npulumi stack rm dev\n```\n\n## 🚀 Infrastructure Deployment\n\n### 1. Execute Infrastructure Deployment\n\n```bash\n# Deploy all resources\nmake up\n\n# Or use Pulumi command directly\npulumi up\n```\n\n### 2. Check Deployment Status\n\n```bash\n# Check stack status\npulumi stack\n\n# Check output values\npulumi stack output\n\n# Check resource status\npulumi stack export\n```\n\n### 3. Configure kubeconfig\n\n```bash\n# Obtain kubeconfig for OKE cluster\noci ce cluster create-kubeconfig \\\n    --cluster-id $(pulumi stack output cluster_id) \\\n    --file ~/.kube/config \\\n    --region ap-osaka-1 \\\n    --token-version 2.0.0\n\n# Verify kubectl connection\nkubectl get nodes\n```\n\n## 📊 Monitoring and Logging\n\n### 1. Monitor Cluster Status\n\n```bash\n# Check OKE cluster status\noci ce cluster get --cluster-id $(pulumi stack output cluster_id)\n\n# Check node pool status\noci ce node-pool get --node-pool-id $(pulumi stack output node_pool_id)\n```\n\n### 2. Check Logs\n\n```bash\n# Check Pulumi logs\npulumi logs\n\n# Check OCI audit logs (web console)\n# OCI Console \u003e Governance \u0026 Administration \u003e Audit\n```\n\n## 🧹 Resource Cleanup\n\n### 1. Delete Infrastructure\n\n```bash\n# Delete all resources\npulumi destroy\n\n# Execute with confirmation\npulumi destroy --yes\n```\n\n### 2. Delete Stack\n\n```bash\n# Delete stack\npulumi stack rm dev\n```\n\n## 🛠️ Troubleshooting\n\n### 1. Common Issues\n\n#### OCI Authentication Issues\n```bash\n# Check OCI configuration\noci setup repair-file-permissions --file ~/.oci/config\noci setup repair-file-permissions --file ~/.oci/oci_api_key.pem\n```\n\n#### Pulumi State Issues\n```bash\n# Refresh state\npulumi refresh\n\n# Recover state\npulumi stack import\n```\n\n#### Kubernetes Connection Issues\n```bash\n# Regenerate kubeconfig\noci ce cluster create-kubeconfig \\\n    --cluster-id \u003ccluster-id\u003e \\\n    --file ~/.kube/config \\\n    --region ap-osaka-1 \\\n    --overwrite\n```\n\n### 2. Debugging\n\n```bash\n# Pulumi debug mode\npulumi up --debug\n```\n\n## 📚 References\n\n- [Pulumi Kubernetes Provider](https://www.pulumi.com/registry/packages/kubernetes/)\n- [Pulumi OCI Provider](https://www.pulumi.com/registry/packages/oci/)\n- [OCI Container Engine for Kubernetes](https://docs.oracle.com/en-us/iaas/Content/ContEng/home.htm)\n- [OCI CLI Official Documentation](https://docs.oracle.com/en-us/iaas/tools/oci-cli/3.43.1/oci_cli_docs/)\n\n## 📝 License\n\nThis project is licensed under the MIT License.\n\n## 🤝 Contributing\n\nBug reports, feature requests, and pull requests are always welcome!\n\n---\n\n**Author**: flexyz \\\n**Email**: contact@flexyz.work \\\n**GitHub**: https://github.com/flexyzwork \\\n**Website**: https://flexyz.work \\\n**Last Updated**: 2th June 2025 \\\n**Version**: 1.0.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexyzwork%2Fpulumi-python-oke-single","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexyzwork%2Fpulumi-python-oke-single","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexyzwork%2Fpulumi-python-oke-single/lists"}