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

WIP - Coredns user config #743

Closed
wants to merge 2 commits into from

Conversation

erikwilson
Copy link
Contributor

For #462

Provides a coredns-user configMap to separate k3s config from user config.

Example:

cat >/var/lib/rancher/k3s/server/manifests/user-coredns-config.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-user
  namespace: kube-system
data:
  Rewrite: |
    rewrite name regex [a-zA-Z.]+\.dev0\.be\.lan traefik.kube-system.svc.cluster.local
EOF

data:
EmptyExample: |
# This is an example empty coredns configmap entry to silence warnings
---
apiVersion: extensions/v1beta1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apiVersion: apps/v1 is better for k8s-v1.14.x, 😃

@erikwilson erikwilson changed the title Update to coredns 1.6.2 WIP - Coredns user config Aug 22, 2019
@mrueg
Copy link
Contributor

mrueg commented Sep 5, 2019

Can we decouple the image bump from the feature add? I would like to see a more recent version of coredns soon :)

@mlebrun
Copy link

mlebrun commented Sep 18, 2019

@erikwilson appreciate you opening this! is there any way I can help in order to get this PR to move forward? Very excited and appreciate you taking time to do this!

@galal-hussein
Copy link
Contributor

@erikwilson I am wondering if we should do this to all manifests, the local storage PR also include a configmap that can be configured for different nodes https://github.com/rancher/k3s/pull/816/files#diff-0683dbb4f157e849170880c2b3a8049eR94

@erikwilson
Copy link
Contributor Author

Thanks @mlebrun! The PR kind of stalled due to limitations with CoreDNS config. I would like to support a hosts directive for users (or at least maintain our own node hosts independent of user hosts settings), but it appears that the hosts plugin can only be used once per zone. Perhaps the PR should move forward anyways tho if the basic usage looks okay.

Unfortunately @galal-hussein I think this is using some CoreDNS specific tricks using the reload and import directives so not sure how portable it is. It would be nice to find a better way to customize manifests tho, since naming and upgrades are an issue.

@mlebrun
Copy link

mlebrun commented Sep 25, 2019

Right, if some version of this functionality could move forward, we would at least have something in the meantime, albeit maybe not perfect. But I would take that over having to modify my CoreDNS config on server restarts! As always, let me know if there's anything I can do outside of gentle nudging 😃

@rpocase
Copy link

rpocase commented Jan 27, 2020

@erikwilson Any plans to revisit this PR? This feature would be extremely valuable for my dev tooling.

@blaggacao
Copy link

Is this somehow superseded? (eg. by what's yet to come in #1899)

@ieugen
Copy link

ieugen commented Nov 16, 2020

Is this PR still relevant?
#1899 has been merged.
If not maybe it can be closed.

@dereknola
Copy link
Member

Closing this PR as out-of-date (by 2 years)
Native config file support exists. #1899

@dereknola dereknola closed this Sep 15, 2021
@ChristianCiach
Copy link

ChristianCiach commented Sep 22, 2021

I don't see how #1899 has any relation to this PR. I need to modify the coredns config to do this: https://coredns.io/2017/05/08/custom-dns-entries-for-kubernetes/

But the config.yaml doesn't help me with this, doesn't it?

Edit: I see, you're probably talking about --resolv-conf=/etc/rancher/k3s/resolv.conf. Yes, this could help with my use-case, too.

Edit 2: I've confused resolv.conf with /etc/hosts, so no, this doesn't help me in realizing https://coredns.io/2017/05/08/custom-dns-entries-for-kubernetes/

@iwilltry42
Copy link
Collaborator

Coming here today as I'm struggling with finding a proper way of modifying the CoreDNS configmap for k3d (e.g. to inject host.k3d.internal and records for the LB and registries, etc.).
Up to now, we're modifying the NodeHosts field of the configmap (as the hosts plugin can only be used once per server), but this feels unsafe, as K3s is also updating this field every now and then.
It works ok so far, but I think having a separate field or even an extra configmap for user-defined hosts would be great for this :)

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

Successfully merging this pull request may close these issues.