pipeline{
agent any
stages {
stage('Hello') {
steps {
echo 'Hello World'
}
}
stage('Testing') {
steps {
echo "Testing stage"
}
}
}
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-python-deployment
spec:
replicas: 3
selector:
matchLabels:
app: python-app
template:
metadata:
labels:
app: python-app
spec:
containers:
- name: my-python-app
image: ske04186/hello_world:latest
imagePullPolicy: Always
ports:
- containerPort: 8000
// service type loadbalancer
apiVersion: v1
kind: Service
metadata:
name: python-app-svc
spec:
selector:
app: python-app
ports:
- protocol: TCP
port: 8000
targetPort: 8000
type: LoadBalancer
를 Sample-Python-App.yaml에 작성하고
kubectl apply -f Sample-Python-App.yaml
kubectl get pods
kubectl get svc
해서 external ip 주소얻고
externalip:8000하면 접속 해진다 .
load balancer 가 알아서 해줌.