Back
Hi, yes there is a way to set custom ports for your service. You can do it through your configuration file you can refer the YAML file below for reference.
apiVersion: v1kind: Servicemetadata: name: nginx1 labels: name: nginx1spec: type: NodePort ports: - port: 80 nodePort: 31221 name: http - port: 443 nodePort: 31221 name: https selector: name: nginx1
apiVersion: v1
kind: Service
metadata:
name: nginx1
labels:
spec:
type: NodePort
ports:
- port: 80
nodePort: 31221
name: http
- port: 443
name: https
selector:
You can check out more about YAML file creation in the attached tutorial
31k questions
32.8k answers
501 comments
693 users