Kubernetes how to open diapason ports in pod
I have the manifest file and I know how to open the port if hi single, but I don`t know how open diapason ports (containerPort: ‘10000-20000’) for the pod.
spec:
containers:
- name: asterisk
image: asterisk
command: ["/bin/bash", "-c", "systemctl start asterisk"]
ports:
- name: sip
containerPort: 5060
protocol: UDP
- name: ssh
containerPort: 22
protocol: TCP
- name: sip-connect
containerPort: '10000-20000'
protocol: UDP
Unfortunately there is not a way to specify ranges like that. Fortunately, the pod-level ports spec is informational, not necessary to operate.
Can I use range ports in services? It`s impossible?
apiVersion: v1
kind: Service
metadata:
name: service-asterisk
spec:
selector:
app: asterisk # Selecting PODS with those Labels
type: NodePort # LoadBalancer | ClusterIP | NodePort
ports:
- name: name-sip-port
port: 5060 # Port on Load Balancer
protocol: UDP
targetPort: sip # Port on POD
- name: name-ssh-port
port: 22 # Port on Load Balancer
targetPort: ssh # Port on POD
- name: sip-connect
port: 10000-20000 # Port on Load Balancer
targetPort: sip-connect # Port on POD