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

Support static public ip address as a Load balancer IP #51

Open
kiranchavala opened this issue Jul 25, 2023 · 1 comment
Open

Support static public ip address as a Load balancer IP #51

kiranchavala opened this issue Jul 25, 2023 · 1 comment
Assignees
Milestone

Comments

@kiranchavala
Copy link

ISSUE TYPE

  • Enhancement request

COMPONENT NAME

Component: Kubernetes/Networking

CLOUDSTACK VERSION

Cloudstack 4.18

SUMMARY

Support static public ip address as a Load balancer IP

STEPS TO REPRODUCE

  1. Deploy Kubernetes cluster on Cloudstack

  2. Create a deployment for example a nginx deployment



apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 # tells deployment to run 2 pods matching the template
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

  1. Expose the deployment as a loadbalancer service

kubectl expose deploy/nginx-deployment --port=80 --type=LoadBalancer

  1. Cloudstack then randomly allocated a public ip as external ip
❯ kubectl get svc nginx-deployment
NAME               TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
nginx-deployment   LoadBalancer   10.109.88.98   10.0.54.83    80:32739/TCP   4m24s

  1. Suppose a user wants a specific public ip as a loadbalancer ip

Currently it's not possible even if we manually edit the service.yaml, cloudstack again allocates a random public ip

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2023-07-25T04:31:03Z"
  finalizers:
  - service.kubernetes.io/load-balancer-cleanup
  name: nginx-deployment
  namespace: default
  resourceVersion: "995303"
  uid: 224691be-fa86-4b07-938c-c86d948b99fb
spec:
  allocateLoadBalancerNodePorts: true
  clusterIP: 10.109.88.98
  clusterIPs:
  - 10.109.88.98
  externalTrafficPolicy: Cluster
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - nodePort: 32739
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
  sessionAffinity: None
  type: LoadBalancer
status:
apiVersion: v1
  loadBalancer:
apiVersion: v1
    ingress:
    - ip: 10.0.54.83

EXPECTED RESULTS

Cloudstack should allocate the specified public ip address

ACTUAL RESULTS

Clodudstack is allocating a radom public ip address

@weizhouapache
Copy link
Member

this could be implemented via annotation, for example service.beta.kubernetes.io/cloudstack-load-balancer-external-ip

@weizhouapache weizhouapache added this to the 1.1.0 milestone May 22, 2024
@vishesh92 vishesh92 modified the milestones: 1.1.0, 1.2.0 Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants