Kubernetes

How to turn the following service into an external one?

spec:
  selector:
    app: some-app
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8081

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Adding type: LoadBalancer and nodePort

spec:
  selector:
    app: some-app
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8081
      nodePort: 32412