I am studying in Serverless Computing with OpenFaaS and Knative. I have some problem with svc of K8s.
Arcording Kubernetes Documentation, we can using internalTrafficPolicy and externalTrafficPolicy to force kubeproxy to forward incomming traffic to the pod in the same node.
In Knative, the component "kourier-gateway" comunicates to component "activator" via kube-proxy. I edited activator's service, so I set internalTrafficPolicy to Local to forward all traffic from kourier-gateway to activator to the pod/activator in the same node. But it wasn't effected, the traffic routed to a pod in other node. The same things happened in traffic from gateway to function pod in OpenFaas.
I want to ask, what can overriding those properties, causing them not to work as expected.
This is svc/activator's yaml file:
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
annotations:
internalTrafficPolicy: Local
ipvs-scheduler: rr
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"activator","app.kubernetes.io/component":"activator","app.kubernetes.io/name":"knative-serving","app.kubernetes.io/version":"1.10.1"},"name":"activator-service","namespace":"knative-serving"},"spec":{"ports":[{"name":"http-metrics","port":9090,"targetPort":9090},{"name":"http-profiling","port":8008,"targetPort":8008},{"name":"http","port":80,"targetPort":8012},{"name":"http2","port":81,"targetPort":8013},{"name":"https","port":443,"targetPort":8112}],"selector":{"app":"activator"},"type":"ClusterIP"}}
creationTimestamp: "2023-05-13T05:32:05Z"
labels:
app: activator
app.kubernetes.io/component: activator
app.kubernetes.io/name: knative-serving
app.kubernetes.io/version: 1.10.1
name: activator-service
namespace: knative-serving
resourceVersion: "6390317"
uid: fa11cebb-3cec-4597-8691-eb4a05776891
spec:
clusterIP: 10.233.4.50
clusterIPs:
- 10.233.4.50
internalTrafficPolicy: Local
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: http-metrics
port: 9090
protocol: TCP
targetPort: 9090
- name: http-profiling
port: 8008
protocol: TCP
targetPort: 8008
- name: http
port: 80
protocol: TCP
targetPort: 8012
- name: http2
port: 81
protocol: TCP
targetPort: 8013
- name: https
port: 443
protocol: TCP
targetPort: 8112
selector:
app: activator
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
I edited activator's service, so I set internalTrafficPolicy to Local to forward all traffic from kourier-gateway to activator to the pod/activator in the same node. But it wasn't effected, the traffic routed to a pod in other node.