<p>I've got a kubernetes cluster which was set up with kops with 1.5, and then upgraded to 1.6.2. I'm trying to use PodPresets. The docs state the following requirements:</p>

<blockquote>
  <ol>
  <li>You have enabled the api type settings.k8s.io/v1alpha1/podpreset</li>
  <li>You have enabled the admission controller PodPreset</li>
  <li>You have defined your pod presets</li>
  </ol>
</blockquote>

<p>I'm seeing that for 1.6.x, the first is taken care of (how can I verify?). How can I apply the second? I can see that there are three kube-apiserver-* pods running in the cluster (I imagine it's for the 3 azs). I guess I can edit their yaml config from kubernetes dashboard and add PodPreset to the admission-control string. But is there a better way to achieve this?</p>

<p>You can list the API groups which are currently enabled in your cluster either with the <code>api-versions</code> kubectl command, or by sending a GET request to the <code>/apis</code> endpoint of your <code>kube-apiserver</code>:</p>



<pre class="lang-none prettyprint-override"><code>$ curl localhost:8080/apis
{
  "paths": [
  "/api",
  "/api/v1",
  "...",
  "/apis/settings.k8s.io",
  "/apis/settings.k8s.io/v1alpha1",
  "...",
}
</code></pre>

<blockquote>
  <p><strong>Note</strong>: The <code>settings.k8s.io/v1alpha1</code> API is enabled by default on Kubernetes v1.6 and v1.7 but will be <a href="https://github.com/kubernetes/kubernetes/pull/47690" rel="nofollow noreferrer">disabled by default in v1.8</a>.</p>
</blockquote>

<p>You can use a kops <a href="https://github.com/kubernetes/kops/blob/master/docs/cluster_spec.md" rel="nofollow noreferrer">ClusterSpec</a> to customize the configuration of your Kubernetes components during the cluster provisioning, including the API servers.</p>

<p>This is described on the documentation page <a href="https://github.com/kubernetes/kops/blob/master/docs/manifests_and_customizing_via_api.md#exporting-a-cluster" rel="nofollow noreferrer">Using A Manifest to Manage kops Clusters</a>, and the full spec for the KubeAPIServerConfig type is available <a href="https://godoc.org/k8s.io/kops/pkg/apis/kops#KubeAPIServerConfig" rel="nofollow noreferrer">in the kops GoDoc</a>.</p>

<p>Example:</p>

<pre class="lang-none prettyprint-override"><code>apiVersion: kops/v1
kind: Cluster
metadata:
  name: k8s.example.com
spec:
  kubeAPIServer:
    AdmissionControl:
      - NamespaceLifecycle
      - LimitRanger
      - PodPreset
</code></pre>

<p>To update an existing cluster, perform the following steps:</p>

<ol>
<li><p>Get the full cluster configuration with</p>

<pre class="lang-none prettyprint-override"><code>kops get cluster name --full
</code></pre></li>
<li><p>Copy the kubeAPIServer spec block from it.</p></li>
<li><p><strong>Do not push back the full configuration</strong>. Instead, edit the cluster configuration with</p>

<pre class="lang-none prettyprint-override"><code>kops edit cluster name
</code></pre></li>
<li><p>Paste the kubeAPIServer spec block, add the missing bits, and save.</p></li>
<li><p>Update the cluster resources with</p>

<pre class="lang-none prettyprint-override"><code>kops update cluster nane
</code></pre></li>
<li><p>Perform a rolling update to apply the changes:</p>

<pre class="lang-none prettyprint-override"><code>kops rolling-update name
</code></pre></li>
</ol>
