반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- blue/green
- Pulumi
- knative
- 오퍼레이터
- Argo
- Litmus
- xdp
- keda
- 카오스 엔지니어링
- opensearch
- mlops
- Kubernetes
- Kubernetes 인증
- argocd
- kubernetes operator
- opentelemetry
- operator
- serving
- Kubeflow
- seldon core
- CI/CD
- CANARY
- nginx ingress
- Kopf
- Model Serving
- MLflow
- gitops
- Continuous Deployment
- tekton
- eBPF
Archives
- Today
- Total
Kubernetes 이야기
Pod에서 python code 실행하기 본문
반응형

Python Script를 실행하기 위해 별도로 Container image를 만들지 않고 간단히 Shell 을 이용해서 코드를 실행 수 있다.
아래와 같은 방법으로 argument에 Python 코드를 입력하여 간단한 application은 실행할 수 있다.
apiVersion: v1
kind: Pod
metadata:
name: python
spec:
containers:
- name: python
image: python:3.8-slim
command:
- "sh"
- "-c"
args:
- |
pip install -q requests
cat << EOF | python -
import requests
URL = 'http://www.tistory.com'
response = requests.get(URL)
print(response.status_code)
print(response.text)
EOF반응형
'개발 > python' 카테고리의 다른 글
| Loguru (0) | 2023.01.24 |
|---|---|
| Fastapi 모범 사례 (0) | 2023.01.22 |
| fastapi 개발 환경 구성 (0) | 2023.01.22 |
| Pipenv로 Python 가상환경 구성 및 패키지 관리하기 (0) | 2023.01.22 |
| centos7 python 3.8 설치 (0) | 2022.05.03 |
Comments