# How set additional flags to the kubernetes cluster?

**URL:** <https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772>\
**Category:** SUSE Rancher Prime\
**Created:** [March 28, 2019, 9:53am UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772 "2019-03-28T09:53:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eike\_H](https://avatars.discourse-cdn.com/v4/letter/e/b38774/32.png) [@Eike\_H](https://forums.suse.com/u/Eike_H)\
**Post date:** [March 28, 2019, 9:53am UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/1 "2019-03-28T09:53:12Z")

</div>

My rancher cluster is behind a corporate proxy. I need to inject the proxy url my pods during installation. Kubernetes can do that by using PodPreset. Is there a way in rancher 2.2 to enable PodPreset in Kubernetes?

---

<div class="post-metadata">

**Author:** ![Eike\_H](https://avatars.discourse-cdn.com/v4/letter/e/b38774/32.png) [@Eike\_H](https://forums.suse.com/u/Eike_H)\
**Post date:** [March 28, 2019, 8:45pm UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/2 "2019-03-28T20:45:08Z")

</div>

Example on how to enable the PodPreset: [https://kubernetes.io/docs/concepts/workloads/pods/podpreset/](https://kubernetes.io/docs/concepts/workloads/pods/podpreset/)

Kubernetes documentation: For example, this can be done by including `settings.k8s.io/v1alpha1=true` in the `--runtime-config` option for the API server. In minikube add this flag `--extra-config=apiserver.runtime-config=settings.k8s.io/v1alpha1=true` while starting the cluster.

How to do that in a 2.2 rancher cluster?

---

<div class="post-metadata">

**Author:** ![Eike\_H](https://avatars.discourse-cdn.com/v4/letter/e/b38774/32.png) [@Eike\_H](https://forums.suse.com/u/Eike_H)\
**Post date:** [March 29, 2019, 5:56pm UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/3 "2019-03-29T17:56:57Z")

</div>

Update: I found in rancher 2.2 the cluster.yaml in the cluster settings. There it is possible to change the parameters for the API server in the section services:

kube-api:  
# IP range for any services created on Kubernetes  
# This must match the service\_cluster\_ip\_range in kube-controller  
service\_cluster\_ip\_range: 10.43.0.0/16  
# Expose a different port range for NodePort services  
service\_node\_port\_range: 30000-32767  
pod\_security\_policy: false  
# Add additional arguments to the kubernetes API server  
# This WILL OVERRIDE any existing defaults  
extra\_args:  
# Enable audit log to stdout  
audit-log-path: “-”  
# Increase number of delete workers  
delete-collection-workers: 3  
# Set the level of log output to debug-level  
v: 4

For me it is unclear how to extend the --runtime-config=[settings.k8s.io/v1alpha1=true](http://settings.k8s.io/v1alpha1=true)

Can you please extend the sample or give me some advice?

---

<div class="post-metadata">

**Author:** ![lawrence](https://avatars.discourse-cdn.com/v4/letter/l/2bfe46/32.png) [@lawrence](https://forums.suse.com/u/lawrence)\
**Post date:** [April 4, 2019, 5:42am UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/4 "2019-04-04T05:42:57Z")

</div>

To change apiserver args, you can click `Edit as Yaml` when you create and edit(update) a RKE cluster.

```auto
  # and the other options...
  kube-api: 
    # and the other kube-api options...
    extra_args:
      runtime-config: "settings.k8s.io/v1alpha1=true"
      # the goal is to add PodPreset admission-controller, here it is appended to the default ones
      enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,PersistentVolumeLabel,PodPreset"

```

After that, you can create podpreset objects by import YAML in the UI, or do it in the kubectl way.

---

<div class="post-metadata">

**Author:** ![Eike\_H](https://avatars.discourse-cdn.com/v4/letter/e/b38774/32.png) [@Eike\_H](https://forums.suse.com/u/Eike_H)\
**Post date:** [April 4, 2019, 4:36pm UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/5 "2019-04-04T16:36:56Z")

</div>

Thank you for the response. I tried to start the server with your settings. So I have edited the yaml file and I have Saved it. After udpating the cluster I tried:

kubectl get podpreset but the result is still: error: the server doesn’t have a resource type “podpreset”

My configuration is that:

kube-api:  
always\_pull\_images: false  
extra\_args:  
enable-admission-plugins: “NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,PersistentVolumeLabel,PodPreset”  
runtime-config: “[settings.k8s.io/v1alpha1=true](http://settings.k8s.io/v1alpha1=true)”  
pod\_security\_policy: false  
service\_node\_port\_range: “30000-32767”

---

<div class="post-metadata">

**Author:** ![janeczku](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/janeczku/32/590_2.png) [@janeczku](https://forums.suse.com/u/janeczku)\
**Post date:** [April 8, 2019, 3:41pm UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/6 "2019-04-08T15:41:52Z")

</div>

@Eike_H i was able to enable PodPresets by updating the cluster.yml with the following content (Rancher v2.2.1 and Kubernetes 1.12.7):

```
[other content]
services:
  [other content]
  kube-api: 
    always_pull_images: false
    pod_security_policy: false
    service_node_port_range: "30000-32767"
    extra_args:
      runtime-config: "settings.k8s.io/v1alpha1=true"
      enable-admission-plugins: "DefaultStorageClass,DefaultTolerationSeconds,LimitRanger,NamespaceLifecycle,NodeRestriction,PersistentVolumeLabel,ResourceQuota,ServiceAccount,PodPreset" 
[other content]

```

After you updated the cluster like that, you can verify if the podpreset resource is correctly enabled by running:  
$ kubectl api-resources | grep podpreset

---

<div class="post-metadata">

**Author:** ![Gregg\_Lowrimore](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/gregg_lowrimore/32/6188_2.png) [@Gregg\_Lowrimore](https://forums.suse.com/u/Gregg_Lowrimore)\
**Post date:** [March 19, 2020, 7:45pm UTC](https://forums.suse.com/t/how-set-additional-flags-to-the-kubernetes-cluster/13772/7 "2020-03-19T19:45:58Z")

</div>

Just be sure if you are copy/pasta these three lines into your cluster config file, that you replace the double-quotes with REAL double-quotes or your cluster will error out and you’ll have to do it again. Spoken from experience!
