미해결
데브옵스(DevOps)를 위한 쿠버네티스 마스터
sessionAffinity 동작관련
실습에 보여주신 것처럼
kubectl edit svc http-go-svc 를 해서
........
selector:
app: http-go
sessionAffinity: ClientIP
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
''''''''
sessionAffinity를 ClientIP로 수정하고
root@master0:~/network# kc run -it --rm --image=busybox sh
실행을 하고 선생님께서 하신것처럼 wget을 실행하면
If you don't see a command prompt, try pressing enter.
/ # wget -O- -q 10.106.148.16
Welcome! v3 http-go-5dc4cdbff7-czrd7
/ # wget -O- -q 10.106.148.16
Welcome! v3 http-go-5dc4cdbff7-czrd7
/ # wget -O- -q 10.106.148.16
Welcome! v3 http-go-5dc4cdbff7-jk5gr
/ # wget -O- -q 10.106.148.16
Welcome! v3 http-go-5dc4cdbff7-jsxrg
/ # wget -O- -q 10.106.148.16
Welcome! v3 http-go-5dc4cdbff7-czrd7
보여주신 것처럼 pod가 고정이 안되고 로드밸런싱이 이루어지는데, 제가 잘못 한 곳이 있을까요?
kubectl version: v1.24.0
pod와 svc 정보는 아래와 같습니다.
# pod 정보
root@master0:~/network# kc get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
bash 1/1 Running 1 (21m ago) 21m 10.0.1.46 node0 <none> <none>
http-go-5dc4cdbff7-czrd7 1/1 Running 0 30m 10.0.1.106 node0 <none> <none>
http-go-5dc4cdbff7-f75n5 1/1 Running 0 30m 10.0.1.94 node0 <none> <none>
http-go-5dc4cdbff7-jk5gr 1/1 Running 0 31m 10.0.1.153 node0 <none> <none>
http-go-5dc4cdbff7-jsxrg 1/1 Running 0 30m 10.0.1.174 node0 <none> <none>
http-go-5dc4cdbff7-mk4fm 1/1 Running 0 30m 10.0.1.223 node0 <none> <none>
# svc 정보
root@master0:~/network# kc get svc -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
http-go-svc ClusterIP 10.106.148.16 <none> 80/TCP 31m app=http-go
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 36m <none>