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

Istio ingress static IP support for GCP #1024

Closed
charlesverdad opened this issue Oct 4, 2017 · 16 comments
Closed

Istio ingress static IP support for GCP #1024

charlesverdad opened this issue Oct 4, 2017 · 16 comments
Assignees

Comments

@charlesverdad
Copy link

charlesverdad commented Oct 4, 2017

After applying this ingress resource in a GKE cluster,

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: static-ip
  # Assumes a global static ip with the same name exists.
  # You can acquire a static IP by running
  # gcloud compute addresses create test-ip --global
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "test-ip"
    kubernetes.io/ingress.class: "istio"
spec:
  tls:
  # This assumes istio-ingress-certs exist with tls.key and tls.crt
  - secretName: istio-ingress-certs 
  backend:
    # This assumes http-svc exists and routes to healthy endpoints.
    serviceName: http-svc
    servicePort: 80

The address returned by kubectl get ing static-ip seem to depend on the ephemeral external ip of the istio-ingress service but is different from the gcloud provisioned test-ip. My expected behavior is for the ingress controller to use the global-static-ip-name test-ip.

@charlesverdad charlesverdad changed the title Istio ingress static ip support for GCP Istio ingress static IP support for GCP Oct 4, 2017
@linsun
Copy link
Member

linsun commented Oct 5, 2017

@ayj this is a GCP issue, can you comment?

@ayj
Copy link
Contributor

ayj commented Oct 6, 2017

kubernetes.io/ingress.global-static-ip-name is not supported by Istio ingress controller.

mandarjog pushed a commit to mandarjog/istio that referenced this issue Oct 30, 2017
* Add OWNERS and pr template for mungegithub

* Update OWNERS

* Update OWNERS


Former-commit-id: 264a86f2a931478991c6ce8aa028556b5998e7f8
mandarjog pushed a commit that referenced this issue Oct 31, 2017
* Add OWNERS and pr template for mungegithub

* Update OWNERS

* Update OWNERS


Former-commit-id: 044c8d8280c06ffa2aa8e1ab3279537ec4e6067f
mandarjog pushed a commit that referenced this issue Oct 31, 2017
* Enable health checks in kube

* gazelle

* enable health checks in integration tests

* fix yamls and add more tests

* no mixer filter for health check ports

* PR nits

* remove mgmt listeners from svc listeners

* update golden files

* Revert "update golden files"

This reverts commit a4339c01c3954ba7e6ef26747aecd4689d1007e2.

* undoing config changes

* merge config.go

* fix compilation error

* new golden files

* lint fixes

* Revert "new golden files"

This reverts commit 5440786a8fea242ccd3d6f2c2d7ae9e47e4254a9.

* undo mock mgmt ports

* Revert "undo mock mgmt ports"

This reverts commit c3869f29f0033954a9a13700327add29581d902f.

* golden files - again!

* generate TCP listeners only

* compilation fix

* Revert "golden files - again!"

This reverts commit 27300daef4e554c0e7faee08cbf9592b27cbf5df.

* go switch is not same as c switch

* whole new goldens again

* nits

* lint fixes
@ldemailly
Copy link
Contributor

do we plan on addressing this ? how do people expose GKE services ?

@vaikas
Copy link

vaikas commented Feb 23, 2018

Are there workarounds for this? Seems pretty limiting to not be able to use static IP with Istio ingress.

@ldemailly
Copy link
Contributor

@vaikas-google the work around is to go in the cloud management UI and switch the ip from ephemeral to static after the ingress is up

for instance:
screen shot 2018-02-22 at 6 09 21 pm

@vaikas
Copy link

vaikas commented Feb 23, 2018 via email

@costinm
Copy link
Contributor

costinm commented Feb 23, 2018 via email

@ldemailly
Copy link
Contributor

We need to support it before we add it, no?

@dennisseidel
Copy link

dennisseidel commented Apr 4, 2018

Am I correct that this workaround only allows to make the ip static but there is no way to attach this static ip address to another existing Istio cluster (e.g. starting a new cluster, attaching the the static ip of the ingress of the old cluster to the ingress of the new cluster, then deleting the old cluster)? Or does the workaround allow for this too?

@ilyasotkov
Copy link
Contributor

@denseidel Not sure if that what you're asking, but if you just want to attach an existing (regional) static IP address to your istio-ingress, you can add spec.loadBalancerIP to your istio-ingress service. More info in Kubernetes docs: https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer

If you use the Helm chart to deploy Istio, these are the changes that are needed to be made (link to a commit in my fork of the Istio Helm chart): exekube/charts@5fc3353

@ldemailly should I submit a PR with the changes to the Helm chart? The feature is very useful for having an ephemeral cluster with a permanent static IP address (and permanent DNS records for it).

@ldemailly
Copy link
Contributor

Yes please!

@ilyasotkov
Copy link
Contributor

#4955 has been merged ✅

You can now reserve a regional static IP address (https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address), then bind it to Istio ingress service like this:

# values.yaml
ingress:
  enabled: true
  ...
  service:
    loadBalancerIP: 130.211.160.207 # (your static IP address)

@ldemailly
Copy link
Contributor

that's great progress, thanks, any way to do it by the name of the reserved ip instead of the actual address ?

@rshriram rshriram assigned rshriram and unassigned rshriram Jun 12, 2018
@rshriram
Copy link
Member

the issue seems to have been resolved by #4955

@Bulat-Gumerov
Copy link

Can anyone give a link for example YAML on how to use istio ingress in GKE with static IP? I've already tried with regional static IP, no success.

0x01001011 pushed a commit to thedemodrive/istio that referenced this issue Jul 16, 2020
Signed-off-by: Gao Hongtao <hanahmily@gmail.com>
@aaaaahaaaaa
Copy link

Google has documentation on how to change the IP of LB provisioned with Istio on GKE clusters using the addon: https://cloud.google.com/anthos/gke/docs/on-prem/archive/1.1/how-to/add-ons/istio#configure_an_external_ip_address

Which is basically patching the istio-ingressgateway:

kubectl patch service istio-ingressgateway --patch '{"spec":{"loadBalancerIP": "<STATIC_IP>"}}' --namespace istio-system

For those using Terraform, my workaround is to patch the gateway using the local-exec provisioner and kubectl. Not pretty but functional (based on hashicorp/terraform-provider-kubernetes#723 (comment)):

resource "null_resource" "istio-load-balancer-ip-patch" {
  provisioner "local-exec" {
    command = <<EOH
cat >/tmp/ca.crt <<EOF
${base64decode(google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate)}
EOF
  kubectl \
  --server="https://${google_container_cluster.my_cluster.endpoint}" \
  --token="${data.google_client_config.default.access_token}" \
  --certificate_authority=/tmp/ca.crt \
  patch service istio-ingressgateway --patch '{"spec":{"loadBalancerIP": "${var.istio_load_balancer_ip}"}}' --namespace istio-system
EOH
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests