# How can I set the "Enabled" property to false on a plugin in Kubernetes?

**URL:** <https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [May 14, 2020, 2:42pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304 "2020-05-14T14:42:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GaryWallace](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GaryWallace](https://discuss.konghq.com/u/GaryWallace)\
**Post date:** [May 14, 2020, 2:42pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/1 "2020-05-14T14:42:32Z")

</div>

I’m trying to add a plugin to Kong in Kubernetes.

I want my plugin configuration to always be part of my yaml file. But the file will be tokenized so that I can set a variable at deployment time to decide whether the plugin will be enabled .

It would look like this.  
Except in this case the Enabled label makes no difference. Is there any way to achieve this?

```
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: global-prometheus
  labels:
    global: "true"
    enabled: ${Some_tokenized_value_replaced_at_deployment_time}
  namespace: kong
  annotations:
    kubernetes.io/ingress.class: XXXXXX
plugin: prometheus

```

---

<div class="post-metadata">

**Author:** ![GaryWallace](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GaryWallace](https://discuss.konghq.com/u/GaryWallace)\
**Post date:** [May 14, 2020, 3:27pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/2 "2020-05-14T15:27:19Z")

</div>

I have tried this, but setting disabled to true didn’t seem to disable my plugin:

```
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: global-prometheus
  labels:
    global: "true"
  namespace: kong
  annotations:
    kubernetes.io/ingress.class: XXXXXX
plugin: prometheus
disabled: ${Some_tokenized_value_replaced_at_deployment_time}
```

---

<div class="post-metadata">

**Author:** ![traines](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/traines/32/158_2.png) [@traines](https://discuss.konghq.com/u/traines)\
**Post date:** [May 14, 2020, 4:46pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/3 "2020-05-14T16:46:44Z")

</div>

Can you share the complete KongPlugin after it was rendered (what you get from `kubectl get kongplugin global-prometheus`) for us to try and replicate? Setting `disabled` in the KongPlugin manifest should control the `disabled` setting on the plugin within Kong.

---

<div class="post-metadata">

**Author:** ![GaryWallace](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GaryWallace](https://discuss.konghq.com/u/GaryWallace)\
**Post date:** [May 14, 2020, 6:35pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/4 "2020-05-14T18:35:11Z")

</div>

> [@traines](#):
>
> kubectl get kongplugin global-prometheus

```
NAME PLUGIN-TYPE AGE
global-prometheus prometheus 3h59m

```

Describe command returns this:

```
Name: global-prometheus
Namespace: kong
Labels: global=true
Annotations: kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"configuration.konghq.com/v1","disabled":true,"kind":"KongPlugin","metadata":{"annotations":{"kubernetes.io/ingress.class":"...
              kubernetes.io/ingress.class: XXXXXX
API Version: configuration.konghq.com/v1
Disabled: true
Kind: KongPlugin
Metadata:
  Creation Timestamp: 2020-05-14T14:23:08Z
  Generation: 9
  Resource Version: 37235502
  Self Link: /apis/configuration.konghq.com/v1/namespaces/kong/kongplugins/global-prometheus
  UID: 1ad6cf5b-012f-409e-9a94-a254cc962f1c
Plugin: prometheus
Events:                

```

The log of the kong ingress-controller shows:  
`I0514 18:32:52.251742 1 kong.go:71] successfully synced configuration to Kong`

After that, I navigate to the Kong metrics URL generated by the plugin and it shows the list of available metrics.  
I would expect it to not return nothing.

---

<div class="post-metadata">

**Author:** ![traines](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/traines/32/158_2.png) [@traines](https://discuss.konghq.com/u/traines)\
**Post date:** [May 14, 2020, 10:01pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/5 "2020-05-14T22:01:05Z")

</div>

Sorry, should have been `kubectl get kongplugin global-prometheus -o yaml`. That said, I think this is normal–disabling the plugin ignores it during request processing, but doesn’t disable any admin API endpoints it provides–those exist even if there are no instances of the plugin configured at all. You’ll still see the metrics endpoint, but it won’t start providing actual request data until the plugin is enabled.

---

<div class="post-metadata">

**Author:** ![GaryWallace](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GaryWallace](https://discuss.konghq.com/u/GaryWallace)\
**Post date:** [May 15, 2020, 5:34am UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/6 "2020-05-15T05:34:29Z")

</div>

Thanks for the reply.  
I have tried disabling the plugin with “disabled: true”.  
I can confirm it was taken into account when check with kublectl.

However, I’m still receiving new metrics on Prometheus.

---

<div class="post-metadata">

**Author:** ![GaryWallace](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@GaryWallace](https://discuss.konghq.com/u/GaryWallace)\
**Post date:** [May 15, 2020, 4:14pm UTC](https://discuss.konghq.com/t/how-can-i-set-the-enabled-property-to-false-on-a-plugin-in-kubernetes/6304/7 "2020-05-15T16:14:16Z")

</div>

Actually after more testing I see that when disabled=true, I’m still receiving metrics bit they are at 0.  
Whereas when disabled=false, I’m receiving the actual metrics.

It`s very confusing to still be receiving metrics when the plugin is supposed to be disabled.
