Why is default load balancer port 80 and 443 is considered as TCP ports? I want to test stickiness as shown in the aws docs either through yaml file or through aws console.
I was using nginx ingress and moved to default load balancer to test stickiness but I see the error Stickiness options not available for TCP protocols
I even tried specifying protocol https
but it doesn't accept. It only allows "SCTP", "TCP", "UDP"
.
apiVersion: v1
kind: Service
metadata:
name: httpd
labels:
app: httpd-service
namespace: test-web-dev
spec:
#type: LoadBalancer
selector:
app: httpd
ports:
- name: port-80
port: 80
targetPort: 80
- name: port-443
port: 443
targetPort: 443
- name: port-1234
port: 1234
protocol: TCP
targetPort: 1234
When I try ingress, I disable the service type Loadbalancer
above
nginx-ingress-lb-service.yml
:
apiVersion: v1
kind: ConfigMap
metadata:
name: tcp-services
namespace: ingress-nginx
data:
1234: "test-web-dev/httpd:1234"
---
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
- name: https
port: 443
protocol: TCP
targetPort: https
- name: port-1234
port: 1234
protocol: TCP
targetPort: 1234
---
Stickiness requires listener which operates in layer 7 of OSI model, which in case of CLB, is provided by http
and https
listeners.
Since you are using TCP
listener which operates in layer 3, stickiness is not supported. Thus, if you want to use sticky sessions, you must change to http
or https
listeners.
UDP
and SCTP
are invalid listeners for CLB. It only supports TCP
, HTTP
, HTTPS
and SSL
.