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 custom DNS IP --dns-service-ip #335

Open
ottodeng opened this issue May 9, 2024 · 7 comments
Open

Support custom DNS IP --dns-service-ip #335

ottodeng opened this issue May 9, 2024 · 7 comments
Labels
area/networking Issues or PRs related to networking kind/feature Categorizes issue or PR as related to a new feature.

Comments

@ottodeng
Copy link
Contributor

ottodeng commented May 9, 2024

Version

Karpenter Version: v0.0.0

Kubernetes Version: v1.0.0

Expected Behavior

the pod on new karpenter node, /etc/resolv.conf is 10.0.0.10. not follow az cli create --dns-service-ip 10.97.96.10.

this issue will cause cannot use custom vnet-subnet-id, the pod on karpenter node can not get reponse from default dns nameserver 10.0.0.10.

Actual Behavior

image

default nodepool

Steps to Reproduce the Problem

each AKS NAP cluster or self-host can reproduce this.

Resource Specs and Logs

(base) [email protected]:/Users/ottodeng/aks/self-host $ kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-deployment-5f7bbf8bb-bkw8z 1/1 Running 0 18m 10.244.4.169 aks-t4-spot-rjz89
nginx-deployment-5f7bbf8bb-hvkvn 1/1 Running 0 18m 10.244.3.132 aks-t4-spot-xg75d
nginx-nodepool-5c64bc7fd8-xl92s 1/1 Running 0 18m 10.244.1.82 aks-nodepool1-32105842-vmss000001
nginx-nodepool-5c64bc7fd8-xs2mr 1/1 Running 0 18m 10.244.2.65 aks-nodepool1-32105842-vmss000000
(base) [email protected]:/Users/ottodeng/aks/self-host $ kubectl exec -it nginx-nodepool-5c64bc7fd8-xl92s cat /etc/resolv.conf
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
search default.svc.cluster.local svc.cluster.local cluster.local kdgjdzanqb1uxn5hrh45i34rib.ix.internal.cloudapp.net
nameserver 10.97.96.10
options ndots:5
(base) [email protected]:/Users/ottodeng/aks/self-host $ kubectl exec -it nginx-deployment-5f7bbf8bb-bkw8z cat /etc/resolv.conf
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
search default.svc.cluster.local svc.cluster.local cluster.local kdgjdzanqb1uxn5hrh45i34rib.ix.internal.cloudapp.net
nameserver 10.0.0.10
options ndots:5
(base) [email protected]:/Users/ottodeng/aks/self-host $

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@Bryce-Soghigian
Copy link
Collaborator

im working on a fix for --dns-service-ip here #329. For now you will only be able to use the default values for --dns-service-ip until that change gets in.

@Bryce-Soghigian Bryce-Soghigian added the area/networking Issues or PRs related to networking label May 9, 2024
@ottodeng
Copy link
Contributor Author

im working on a fix for --dns-service-ip here #329. For now you will only be able to use the default values for --dns-service-ip until that change gets in.

Thanks Bryce, will it merge into main in these days?

@NMFR
Copy link

NMFR commented Jul 22, 2024

Hi,

Any update on this or any workaround?

I am also trying to use Karpenter with a custom subnet and the pod DNS is broken.

@gorositopablo
Copy link

Thanks @Bryce-Soghigian . Unfortunately, we have run into the same issue.

Does anyone have any workaround for it?

Thanks

@tallaxes tallaxes changed the title Karpenter node dns nameserver not follow cluster defined. Support custom DNS IP --dns-service-ip Aug 28, 2024
@tallaxes tallaxes added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 28, 2024
@ppodevlabs
Copy link

Any update on this? This is blocking us from using Karpenter in AKS

@bedij03
Copy link

bedij03 commented Nov 29, 2024

Hi,

We are also having the same issue.
Any update on when this is likely to be fixed ?

Thanks

@tesharp
Copy link

tesharp commented Jan 14, 2025

We have setup latest azure karpenter on cilium byocni cluster and got it working using some redirect policy and external secret for bootstrap token rotation. Also using secret reloader to automatically reload karpenter so it uses the latest token, otherwise it just failed to create nodes after a while. Seems to be running ok now with 0.7.1 which fixed problem with deleting vm's that did not exist.

Redirect policy to redirect dns requests on 10.0.0.10 to node-local-dns:

apiVersion: cilium.io/v2
kind: CiliumLocalRedirectPolicy
metadata:
  name: dns-local-redirect
  namespace: kube-system
spec:
  redirectFrontend:
    addressMatcher:
      ip: "10.0.0.10"
      toPorts:
      - name: dns
        port: "53"
        protocol: UDP
      - name: dns-tcp
        port: "53"
        protocol: TCP
  redirectBackend:
    localEndpointSelector:
      matchLabels:
        app.kubernetes.io/instance: node-local-dns
        app.kubernetes.io/name: node-local-dns
    toPorts:
    - name: dns
      port: "53"
      protocol: UDP
    - name: dns-tcp
      port: "53"
      protocol: TCP

External secret to create a secret with bootstrap token

apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: karpenter-bootstrap-token
  namespace: kube-system
spec:
  refreshInterval: 5m
  secretStoreRef:
    kind: SecretStore
    name: k8s-store-kube-system
  target:
    name: karpenter-bootstrap-token
    template:
      engineVersion: v2
      data:
        token: |-
          {{- $id := "" }}
          {{- $secret := "" }}
          {{- range $key, $token := . }}
            {{- $json := fromJson $token }}
            {{- $id = index $json "token-id" }}
            {{- $secret = index $json "token-secret" }}
          {{- end -}}
          {{ $id }}.{{ $secret }}
  dataFrom:
  - find:
      name:
        regexp: "bootstrap-token-.*"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking Issues or PRs related to networking kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

8 participants