kubectl expose port code example
Example 1: k8s service example
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
Example 2: how to expose external ip in kubernetes
kubectl expose deployment hello-world --type=LoadBalancer --name=my-service