Skip to content

proposal: Add --kind, --node-selectors, --set flags to support Helm init --net-host #2299

Closed

Description

@jascott1

Use cases

  • Control where Tiller pod lands

  • Install CNI driver with Helm

kubeadm init
helm init --net-host --node-selectors="app=helm"
helm install stable/flannel

Problems

Helm init --net-host sets Tiller to be installed with HostNetwork enabled which facilitates loading a CNI overlay (like flannel) but operator cannot control where the pod is scheduled. There is also an issue with Kubernetes 1.6 where Deployments will not load CNI at that early stage but Daemonsets will correctly load CNI.

New Flags

We propose adding the following flags to helm init

--node-selectors

Specifies which labels are required on a node for Tiller to be scheduled on it. A node must posses all of the specified labels to be acceptable for Tiller.

# a single label
helm init --node-selectors="app=helm"

# specifying multiple labels (all are required)
helm init --node-selectors="app=helm,type=label1,other=label2"

--set

Specifies additional keys and values to be set in the Tiller template.

helm init --set spec.hostnetwork=true --set spec.template.nodeSelector=app=helm

--output|-o

Dumps the Tiller resource to stdout instead of installing it and does not install the client. Can be used with --set to modify the manifest on the fly and save it to file (e.g. manifests directory).

Nice to Have Flags (Deferred)

The following flags would be nice to have to enable the currently blocked CNI installation (need --kind=daemonset) and allow user to set node-selector labels conveniently.

--kind

Specifies which type of of object Tiller should be instantiated as: deployment, daemonset

# set to daemonset. --node-selectors flag is required for daemonset
helm init --kind=daemonset --node-selectors="app=helm"

# default
helm init --kind=deployment

Notes

To land Tiller on the master node, the master will need to have the NoSchedule taint removed.

Activity

  1. bacongobbler commented on Apr 19, 2017

    @bacongobbler
    Member

    At this point I wonder if it's just better to send a formatted spec template as input to helm init, or else we're going to be writing out the entire Deployment spec as feature flags to deploy tiller.

  2. kfox1111 commented on Apr 19, 2017

    @kfox1111

    yeah, I wondered about that myself. the benefit is it would be infinitely configurable. though that can be done today by just uploading a yaml manually and skipping helm init all together. The drawback is that it would require more then grabbing a helm binary to get going. It would be really nice to do something like:

    kubeadm init;
    helm init --daemonset;
    helm install stable/flannel (or other sdn of choice);
    helm install kube-advanced #installs kube-dns, kube-proxy, kube-dashboard, etc

    Then almost everything is easily upgradable/managed via helm.

  3. jascott1 commented on Apr 19, 2017

    @jascott1
    ContributorAuthor

    Just a though but could use --set and be smart about setting tolerations and labels in YAML path dot notation. Keep --daemonset and add --file for everything else.

    So could do

    helm init --daemonset --set path.to.labels="app=helm"
    
  4. kfox1111 commented on Apr 19, 2017

    @kfox1111

    in theory you wouldn't need daemonset nor net-host then too. you could do everything through --set or --values with a values file to merge on top of the template.

    It, would be infinitely flexible, but not simple to use from the above example?

  5. jascott1 commented on Apr 19, 2017

    @jascott1
    ContributorAuthor

    Seems using --set for damonset would be possible but difficult as it changes the object type.
    --values gets into templating which I guess we could explore but seems like overkill (correct me if im wrong).

    Last example seems like nice balance of hitting the 80% easily but having complete control also using --file (and --set i guess)

  6. jascott1 commented on Apr 19, 2017

    @jascott1
    ContributorAuthor

    Forgot net-host. Would be

    helm init --net-host --daemonset --set path.to.labels="app=helm"
    
  7. kfox1111 commented on Apr 20, 2017

    @kfox1111

    for the 90% case of this use case, at least on 1.6, you would need
    net=host, a nodeSelector to limit it to one node, and kind=daemonset.

    It would be nice to limit the length of string needed to enable the use case.

    remembering to do:
    helm init --net-host --daemonset --set spec.template.nodeSelector=app=helm is rather verbose.

    also, specifically --node-selector is very useful outside of this use case in a regular 'helm init' case when you have a hybrid cluster. none of my k8s systems have just one node type and helm really should be pinned to only controllers. So, I kind of think it shoudl get its own flag?

  8. kfox1111 commented on Apr 20, 2017

    @kfox1111

    maybe we do those 3 things as flags, and the rest with --set?

  9. jascott1 commented on Apr 20, 2017

    @jascott1
    ContributorAuthor

    Sounds reasonable:

    helm init --net-host --kind=daemonset --node-selectors="app=helm" --set path.to.tolerations=MyTaint
    
  10. jascott1 commented on Apr 20, 2017

    @jascott1
    ContributorAuthor

    +1 for future compatibility for --kind

  11. changed the title [-]proposal: Add --daemonset, --node-selectors, --tolerations flags to support Helm init --net-host[/-] [+]proposal: Add --kind, --node-selectors, --set flags to support Helm init --net-host[/+] on Apr 20, 2017
  12. jascott1 commented on Apr 20, 2017

    @jascott1
    ContributorAuthor

    @bacongobbler have any strong feelings on --file? Seems we can get by with these alone but can see the utility of having --file.

  13. kfox1111 commented on Apr 20, 2017

    @kfox1111

    one other possibility. rather then add --set,
    there could be a --template flag. it could spit out the rendered template in json format to stdout.

    The user could then use jq. to tweak it to their liking and upload it via kubectl.

  14. kfox1111 commented on Apr 20, 2017

    @kfox1111

    the --template flag would also work nicely if kind=pod if you wanted to run tiller as a static pod, you would:

    helm init --net-host --kind=pod --template > /etc/kubernetes/manifest/tiller.yaml
    
  15. jascott1 commented on Apr 20, 2017

    @jascott1
    ContributorAuthor

    We might want to keep that for next rev if someone demands kind=pod for this flexibility. Plus we might be shot if we add 4 flags at once :)

  16. 12 remaining items

  17. kfox1111 commented on May 26, 2017

    @kfox1111

    I've been using a --kind=pod like config for a while now, and its extremely handy to launch helm before you have a fully working k8s. I'm guessing it will become more common for others to attempt it in time.

    If I could get my top wishlist though, I think it would be in this order I think:

    1. -o json (or something similar. Give me the raw object that will be loaded instead of doing it. I can more easily manipulate it with jq to do stuff to it before loading. This prevents having to upload a broken tiller config, then edit it.)
    2. --node-selector (Not a single cluster I've deployed was homogenious. Landing it into a pool I need it to go is critical)
    3. --kind DaemonSet (Allows for sdn helm packages to start getting written. That will take time, so the earlier the better) This also needs --net-host to function
    4. --kind static-pod (This, implies --net-host and -o json, should allow helm to be easily launched and used to manage all the k8s services in a boot2kube like environment. helm init --kind=pod > /etc/kubermentes/manifest; You then can have a helm managed kube-apiserver, kube-proxy, sdn plugin, kube-dashboard/kube-dns, etc)
    5. --set. Sets cool, but syntactic suger for option number 1.

    I'm thinking all of this stuff shouldn't be much of a burden on the helm devs long term? I think once its implemented it should be pretty static in the future. number one and number five will allow great flexibility for edge case handling I think?

  18. kfox1111 commented on May 26, 2017

    @kfox1111

    btw, for grins, here's a first stab at flannel as a helm package. :)
    https://github.com/kfox1111/charts/tree/flannel/stable/flannel

    Once helm has support for the use case, I plan on submitting it to the kubernetes/charts repo.

  19. thomastaylor312 commented on May 31, 2017

    @thomastaylor312
    Contributor

    I agree with @kfox1111 on this one, but also think --file should be an option. With an --output option and --file, it gives you the flexibility to set up things as you'd like to or to just provide a file.

    For the first pass, I would think the output, node-selector, and file options would be good in one PR and then we can break out the others into their own features. That sound good @technosophos and @jascott1? I would love to see this move forward

  20. kfox1111 commented on May 31, 2017

    @kfox1111

    @thomastaylor312 Not sure I understand the difference between -o json and --file. Can we nail down those semantics real quick?

    I think we should be able to get a version of this up and running pretty quickly.

  21. thomastaylor312 commented on May 31, 2017

    @thomastaylor312
    Contributor

    @kfox1111 I was just talking about the --file flag mentioned earlier. Basically so you can output a tiller manifest using -o json and then modify it to your liking and provide it to helm init using --file. But I guess you could also just use kubectl create with the manifest, so maybe it isn't actually worth it to have a --file flag.

    tl;dr: Never mind, forget I said anything about the --file flag.

    Also, when you said "I think we should be able to get a version of this up and running pretty quickly," did you mean you are already working on it?

  22. kfox1111 commented on May 31, 2017

    @kfox1111

    @jascott1 said he was going to work on it. but if he can't do it in the next day or two, I can take a quick stab at it.

  23. djsly commented on Jul 13, 2017

    @djsly

    I would like to add a special note about Tolerations. I want to use nodeSelector in conjunction with Toleration since I have a taint on the node I want to deploy Tiller on.

  24. djsly commented on Jul 13, 2017

    @djsly

    I just look at the PR and it seems that the --set option might allow us to set Tolerations. Any specific reasons why the NodeSelector parameter as its own option VS using the --set option? Maybe I'm missing something with regards to the --set option...

  25. jascott1 commented on Jul 13, 2017

    @jascott1
    ContributorAuthor

    @djsly You can use --set for nodeSelectors but --node-selectors is commonly needed to control where Tiller lands so its included as a flag for convenience. We are currently hard-coding a linux nodeSelector (that can be overridden) but this PR will remove that and allow users that still need it to specify with --node-selectors easily.

  26. added a commit that references this issue on Jul 19, 2017
    9411351
  27. added 4 commits that reference this issue on Oct 9, 2017
    b806520
    107306c
    6abe222
    16c579f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurehelp wanted

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions