Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] LoadBalancerIP does not work with servicetype=LoadBalancer #283

Closed
baziwane opened this issue Jan 26, 2023 · 0 comments
Closed

[BUG] LoadBalancerIP does not work with servicetype=LoadBalancer #283

baziwane opened this issue Jan 26, 2023 · 0 comments
Assignees
Labels
Bug A bug filed by an internal or external team that affects the customers known-issue
Milestone

Comments

@baziwane
Copy link
Collaborator

In AKS hybrid, when a user specifies the LoadBalancerIP for a service as described in the Kubernetes service spec, this does not work.

Workaround
For now, we recommend using ExternalIPs as we work on a permanent fix in an upcoming release. You need to make sure the IP address is within the range of the VIP pool you used during cluster creation. Below is an example of how you would assign a static IP address to a service in AKS hybrid.

Step 1 - Create an application deployment. In this example I will use nginx.

kubectl create deployment nginx --image=nginx

Step 2 - Create a service of type=LoadBalancer and set the value externalIPs with the static IP address that you want to use to access the service.
Note: You cannot specify an IP address that's outside the range that was when you created the cluster network.

Save the following example in a file named nginx-service.yaml

apiVersion: v1
kind: Service
metadata:
 name: nginx
 annotations:
spec:
 type: LoadBalancer
 ports:
  - port: 80
  protocol: TCP
  targetPort: 80
 selector:
  app: nginx
 externalIPs:
 - 192.168.248.15 # this IP address should be in the same range as your VIP pool 

Open a terminal and run kubectl apply to create the service

kubectl apply -f nginx-service.yaml

You can verify that the externalIP has been assigned to the service by running the following command:

kubectl get svc

NAME     TYPE      CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
kubernetes  ClusterIP   10.96.0.1    <none>     443/TCP    5d18h
nginx    LoadBalancer  10.120.110.180  192.168.248.15  80:30304/TCP  7s

Step 3 - Test the service

Run curl to verify that the service is reachable:

curl 192.168.248.15
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
@baziwane baziwane added the Bug A bug filed by an internal or external team that affects the customers label Jan 26, 2023
@scooley scooley added this to the 2023-03-14 milestone Mar 16, 2023
@scooley scooley closed this as completed Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug filed by an internal or external team that affects the customers known-issue
Projects
Status: GA - Last 3 release
Development

No branches or pull requests

3 participants