<p>I have a traefik.toml file defined as part of my traefik configmap. The snippet below is the kubernetes endpoint configuration with a labelselector defined:</p>

<pre><code>[kubernetes]
  labelselector = "expose=internal"
</code></pre>

<p>When I check the traefik status page in this configuration, I see all ingresses listed, not just those with the label "expose: internal" defined.</p>

<p>If I set the kubernetes.labelselector as a container argument to my deployment, however, only the ingresses with the matching label are displayed on the traefik status page as expected:</p>

<pre><code>- --kubernetes.labelselector=expose=internal
</code></pre>

<p>According to the <a href="https://docs.traefik.io/toml/#kubernetes-ingress-backend" rel="nofollow noreferrer">Kubernetes Ingress Backend</a> documentation, any label selector format valid in the label selector section of the <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors" rel="nofollow noreferrer">Labels and Selectors</a> should be valid in the traefik.toml file. I have experimented with both the equality baed (as shown above) and the set-based (to determine if the "expose" label is present, only), neither of which have worked in the toml. The set-based does not seem to work in the container args, but the equality statements do.</p>

<p>I'm assuming there is some issue related to how I've formatted the kubernetes endpoint within the traefik.toml file. Before reporting this issue to github I was hoping someone could clarify the documentation and/or correct any mistakes I've made in the toml file format.</p>

<p>As you have already found out, not passing <code>--kubernetes</code> makes things work for you. The reason is that this parameter not only enables the Kubernetes provider but also sets all defaults. <a href="http://docs.traefik.io/basics/#static-trfik-configuration" rel="nofollow noreferrer">As documented</a>, the command-line arguments take precedence over the configuration file; thus, any non-default Kubernetes parameters specified in the TOML file will be overridden by the default values implied through <code>--kubernetes</code>. This is intended (albeit not ideally documented) behavior.</p>

<p>You can still mix and match both command-line and TOML configuration parameters for Kubernetes (or any other provider, for that matter) by omitting <code>--kubernetes</code>. For instance, you could have your example TOML file</p>

<pre><code>[kubernetes]
  labelselector = "expose=internal"
</code></pre>

<p>and then invoke Traefik like</p>

<pre><code>./traefik --configfile=config.yaml --kubernetes.namespaces=other
</code></pre>

<p>which will cause Traefik to use both the custom label selector <code>expose=internal</code> and watch the namespace <code>other</code>.</p>

<p>I have <a href="https://github.com/containous/traefik/pull/1830" rel="nofollow noreferrer">submitted a PR</a> to clarify the behavior of the command-line provider-enabling parameters with regards to the provider default values.</p>
