작성
·
581
1
실습에 보여주신 것처럼
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>
답변 1
0
넵 확인 감사합니다.
보여 주신 내용에서는 특이 사항은 없어보입니다.
cilium 설정 확인하셔서 Session affinity가 활성화 되어 있는지 확인이 가능하실까요?
https://docs.cilium.io/en/stable/gettingstarted/kubeproxy-free/#validate-the-setup
감사합니다.
cilium의 기본 설정으로는 동작 되지 않으며 다음 명령을 실행하고
kubectl edit configmap -n kube-system cilium-config
kube-proxy-replacement 설정을 strict로 변경 후 사용하면 잘 동작하는 것을 확인했습니다.
kube-proxy-replacement: strict
감사합니다.
os ubuntu 18.4 이구요
cni는 celium으로 했습니다.
root@master0:~# kc describe deployment http-go
Name: http-go
Namespace: default
CreationTimestamp: Mon, 30 May 2022 17:15:10 +0900
Labels: app=http-go
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=http-go
Replicas: 5 desired | 5 updated | 5 total | 5 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: app=http-go
Containers:
http-go:
Image: jjcheon1/http-go:v4
Port: 8080/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetAvailable
Available True MinimumReplicasAvailable
OldReplicaSets: <none>
NewReplicaSet: http-go-5dc4cdbff7 (5/5 replicas created)
Events: <none>
root@master0:~# kc describe svc http-go
Name: http-go-svc
Namespace: default
Labels: <none>
Annotations: <none>
Selector: app=http-go
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.106.148.16
IPs: 10.106.148.16
Port: <unset> 80/TCP
TargetPort: 8080/TCP
Endpoints: 10.0.1.106:8080,10.0.1.153:8080,10.0.1.174:8080 + 2 more...
Session Affinity: ClientIP
Events: <none>