Answers: <p>Either make <code>service/mobile-api-service</code> of LoadBalancer type or use Kubernetes Ingress to expose the workload to external connectivity.  Using LoadBalancer service would be the easiest. However, your cloud provider needs to support provisioning LoadBalancers.</p>
  <p>I described a <a href="https://www.rokpoto.com/kubernetes-ingress-demo/" rel="nofollow noreferrer">demo of Kubernetes Ingress</a>. The post also talks about Kubernetes Load Balancer service limitations.</p>
  <p>To play with <a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/#loadbalancer-access" rel="nofollow noreferrer">minikube loadbalancers</a> use <code>minikube tunnel</code> command.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-02-01T17:26:55.253Z
Answers: 2023-02-01T17:26:55.253Z
Answers: rokpoto.com
Answers: <p>You can try and experiment with <a href="https://metallb.universe.tf/" rel="nofollow noreferrer">metallb</a> and use Loadbalancer service
  Another option is to use node port with external Loadbalancer.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-02-01T15:58:58.093Z
Answers: 2023-02-01T15:58:58.093Z
Answers: igiannak
Body: <p>I want to know what are production alternatives to make <a href="http://192.168.49.2:30001" rel="nofollow noreferrer">http://192.168.49.2:30001</a> this accessible http://host_machine_ip:8007 here</p>
  <p>I have set up minikube cluster with mobile-api service on it.</p>
  <pre><code>minikube service mobile-api-service --url this returns http://192.168.49.2:30001
  </code></pre>
  <p>curl <a href="http://192.168.49.2:30001" rel="nofollow noreferrer">http://192.168.49.2:30001</a> returns</p>
  <pre><code>{&quot;mobileApi/dashboard&quot;:&quot;http://192.168.49.2:30001/mobileApi/dashboard/&quot;,
  &quot;mobileApi/notification&quot;:&quot;http://192.168.49.2:30001/mobileApi/notification/&quot;,
  &quot;mobileApi/feedback&quot;:&quot;http://192.168.49.2:30001/mobileApi/feedback/&quot;}
  </code></pre>
  <p>so my API is accessible on <a href="http://192.168.49.2:30001" rel="nofollow noreferrer">http://192.168.49.2:30001</a> from the host machine.</p>
  <p>but i want to make it accessible http://host_machine_ip:8007.</p>
  <p>when I do</p>
  <pre><code>kubectl port-forward --address 0.0.0.0 service/mobile-api-service 8007:8007
  </code></pre>
  <p>it makes http://host_machine_ip:8007 work as I want but I am sure this is not a production-like case.</p>
  <h2>Update</h2>
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: mobile-api-service
  spec:
    selector:
      app: mobile-api
    type: LoadBalancer
    ports:
      - protocol: TCP
        port: 8007
        targetPort: 8007
        nodePort: 30001
  </code></pre>
  <p>this is service it is loadBalancer</p>
  
Tags: <docker><kubernetes><networking><kubectl><minikube>
Title: I am looking for a production alternative to kubectl port-forward
UserDisplayName: Giorgi Beria
ThreadText: # I am looking for a production alternative to kubectl port-forward
  
  (Asked by: username_0 on 2023-02-01)
  
  I want to know what are production alternatives to make <http://192.168.49.2:30001> this accessible http://host\_machine\_ip:8007 here
  
  I have set up minikube cluster with mobile-api service on it.
  
  ```
  minikube service mobile-api-service --url this returns http://192.168.49.2:30001
  
  ```
  
  curl <http://192.168.49.2:30001> returns
  
  ```
  {"mobileApi/dashboard":"http://192.168.49.2:30001/mobileApi/dashboard/",
  "mobileApi/notification":"http://192.168.49.2:30001/mobileApi/notification/",
  "mobileApi/feedback":"http://192.168.49.2:30001/mobileApi/feedback/"}
  
  ```
  
  so my API is accessible on <http://192.168.49.2:30001> from the host machine.
  
  but i want to make it accessible http://host\_machine\_ip:8007.
  
  when I do
  
  ```
  kubectl port-forward --address 0.0.0.0 service/mobile-api-service 8007:8007
  
  ```
  
  it makes http://host\_machine\_ip:8007 work as I want but I am sure this is not a production-like case.
  
  ## Update
  
  ```
  apiVersion: v1
  kind: Service
  metadata:
    name: mobile-api-service
  spec:
    selector:
      app: mobile-api
    type: LoadBalancer
    ports:
      - protocol: TCP
        port: 8007
        targetPort: 8007
        nodePort: 30001
  
  ```
  
  this is service it is loadBalancer
  
  **Tags:** docker, kubernetes, networking, kubectl, minikube
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-02-01. Score: 0 | Accepted answer
  
  Either make `service/mobile-api-service` of LoadBalancer type or use Kubernetes Ingress to expose the workload to external connectivity. Using LoadBalancer service would be the easiest. However, your cloud provider needs to support provisioning LoadBalancers.
  
  I described a [demo of Kubernetes Ingress](https://www.username_1/kubernetes-ingress-demo/). The post also talks about Kubernetes Load Balancer service limitations.
  
  To play with [minikube loadbalancers](https://minikube.sigs.k8s.io/docs/handbook/accessing/#loadbalancer-access) use `minikube tunnel` command.
  
  
  ---
  
  ### Answer by username_2 on 2023-02-01. Score: 0
  
  You can try and experiment with [metallb](https://metallb.universe.tf/) and use Loadbalancer service
  Another option is to use node port with external Loadbalancer.
  
  
  ---
  
  