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

GKE: Using pod dns names (service scoped) doesn't work on GKE thus preventing ControlPlane -> DP's Admin API traffic #179

Open
pmalek opened this issue May 24, 2023 · 4 comments
Labels
area/gateway-api area/gcp area/managed-gateways bug Something isn't working migrated-from-archive Issues migrated from the archived KGO repository

Comments

@pmalek
Copy link
Member

pmalek commented May 24, 2023

Current Behavior

Currently when ControlPlane creates Admin API address for a particular Gateway it uses Pods A record (ref: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#a-aaaa-records-1) which works on kind (which uses coredns) but doesn't work on GKE (which uses kube-dns).

Related piece of code:

func controllerKongAdminURL(podIP, adminServiceName, podNamespace string) string {
return fmt.Sprintf("https://%s.%s.%s.svc:%d",
strings.ReplaceAll(podIP, ".", "-"), adminServiceName, podNamespace, dataplaneutils.DefaultKongAdminPort)
}
.

This effectively make the ControlPlane -> DataPlane's Admin API traffic to not work on GKE.

The following is a log from KIC using GD on GKE but the same happens when using operator with ControlPlane bound to a DataPlane (e.g. via a Gateway object).

time="2023-05-24T12:51:26Z" level=info msg="Retrying kong admin api client call after error" error="making HTTP request: Get \"https://10-12-56-9.kong-admin.kong.svc:8444/\": dial tcp: lookup 10-12-56-9.kong-admin.kong.svc on 10.12.48.42:53: no such host" logger=setup retries=119/120

This is important to think about this in the context of KIC and KGO collaboration because:

Related KIC issue: Kong/kubernetes-ingress-controller#4065

Expected Behavior

ControlPlane <-> DataPlane traffic works on GKE.

Operator Version

9a7d17a

@pmalek pmalek added the bug Something isn't working label May 24, 2023
@shaneutt
Copy link
Contributor

shaneutt commented Jun 29, 2023

If the resolution to this issue results in there still being since the resolution of this issue will result in there being different options needing to be applied based on cloud provider, we should consider employing https://github.com/Kong/gateway-operator/issues/867 to automate this as a follow-up.

@pmalek
Copy link
Member Author

pmalek commented Jun 29, 2023

The problem with this on GKE is that:

kube-dns only creates DNS records for Services that have Endpoints.

https://cloud.google.com/kubernetes-engine/docs/how-to/kube-dns#service-dns-records.

Which would require us to not only use different methods of creating URLs, but also different Service types because currently we use a headless Service which due to the above limitation cannot work on GKE.

Hence we'd need to use a ClusterIP Service.

@gAmUssA
Copy link

gAmUssA commented Oct 19, 2023

Found a «workaround» in one of [SO answers](https://stackoverflow.com/questions/55122234/installing-coredns-on-gke.
Basically, installing CoreDNS on GKE instead of kube-dns

git clone https://github.com/coredns/deployment.git
cd deployment/kubernetes
./deploy.sh > corends-deployment.yaml
kubectl apply -f corends-deployment.yaml
kubectl scale --replicas=0 deployment/kube-dns-autoscaler --namespace=kube-system
kubectl scale --replicas=0 deployment/kube-dns --namespace=kube-system

This seems to work for me on GKE

Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.27.3-gke.100

@pmalek pmalek added the migrated-from-archive Issues migrated from the archived KGO repository label Apr 19, 2024
@czeslavo czeslavo transferred this issue from another repository Apr 22, 2024
@czeslavo czeslavo transferred this issue from another repository Apr 23, 2024
@pmalek
Copy link
Member Author

pmalek commented May 22, 2024

Created an issue for kube-dns to request providing service scoped dns names: kubernetes/dns#633

pmalek pushed a commit that referenced this issue Jun 29, 2024
Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.24.3 to 0.24.4.
- [Release notes](https://github.com/kubernetes/client-go/releases)
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](kubernetes/client-go@v0.24.3...v0.24.4)

---
updated-dependencies:
- dependency-name: k8s.io/client-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway-api area/gcp area/managed-gateways bug Something isn't working migrated-from-archive Issues migrated from the archived KGO repository
Projects
None yet
Development

No branches or pull requests

4 participants