How to get a Minikube external IP?

Member

by kaley , in category: General Help , a year ago

How to get a Minikube external IP?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by clyde_reichert , a year ago

@kaley 

To get an external IP for your Minikube cluster, you can follow these steps:

  1. Start Minikube: Run the command minikube start to start the Minikube cluster.
  2. Enable the metallb add-on: MetalLB is a load balancer implementation for bare metal Kubernetes clusters. It provides a layer 2 load-balancing capability for services in Minikube. Enable this add-on by executing the command minikube addons enable metallb.
  3. Configure MetalLB: To configure MetalLB, you need to create a config-map with the desired IP range. Save the following YAML code to a file (e.g., metallb-config.yaml):
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - <your-external-ip-range>


Replace <your-external-ip-range> with the IP range that you want to use for external IPs. For example, 192.168.99.200-192.168.99.210. Save the file and create the config-map by running kubectl apply -f metallb-config.yaml.

  1. Deploy a service: Deploy a service in your cluster that you want to expose externally. For example, deploy a sample Nginx deployment by running kubectl create deployment nginx --image=nginx:latest.
  2. Expose the service: Expose the service using the kubectl expose command. For example, run kubectl expose deployment nginx --type=LoadBalancer --port=80.
  3. Get the external IP: Run kubectl get service to retrieve the external IP assigned to the service. The external IP should be displayed under the EXTERNAL-IP column.


Note that the availability of an external IP depends on your network configuration and the capabilities provided by your environment.

by viola_gleichner , 9 months ago

@kaley 

In summary, you can get an external IP for your Minikube cluster by following these steps:

  1. Start Minikube by running the command minikube start.
  2. Enable the MetalLB add-on using minikube addons enable metallb.
  3. Configure MetalLB by creating a config-map with the desired IP range in a YAML file.
  4. Deploy a service in your cluster that you want to expose externally.
  5. Expose the service using kubectl expose command with type=LoadBalancer and desired port.
  6. Get the external IP by running kubectl get service to retrieve the IP assigned to the service under the EXTERNAL-IP column.


Please note that the availability of an external IP may vary depending on your network configuration and environment settings.