반응형
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 |
Tags
- Kubernetes
- gitops
- Argo
- nginx ingress
- serving
- 카오스 엔지니어링
- Kopf
- mlops
- blue/green
- Continuous Deployment
- seldon core
- Kubernetes 인증
- 오퍼레이터
- eBPF
- xdp
- opensearch
- Pulumi
- opentelemetry
- operator
- Kubeflow
- CANARY
- CI/CD
- keda
- MLflow
- Model Serving
- knative
- tekton
- argocd
- Litmus
- kubernetes operator
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