<hr />
<h1>Background</h1>
<p>I'm attempting to configure a cluster via <code>kubeadm</code>. I normally create the (test) cluster via:</p>
<pre><code>sudo kubeadm init --pod-network-cidr 10.244.0.0/16
</code></pre>
<p>This parameter appears to eventually find its way into the static pod definition for the controllerManager (<code>/etc/kubernetes/manifests/kube-controller-manager.yaml</code>):</p>
<pre><code>- --cluster-cidr=10.244.0.0/16
</code></pre>
<p>Larger portions of <code>sudo vim /etc/kubernetes/manifests/kube-controller-manager.yaml</code>:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    component: kube-controller-manager
    tier: control-plane
  name: kube-controller-manager
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-controller-manager
    - --allocate-node-cidrs=true
    - --authentication-kubeconfig=/etc/kubernetes/controller-manager.conf
    - ...
    - --cluster-cidr=10.244.0.0/16
</code></pre>
<hr />
<h1>Question 1:</h1>
<p>How can I pass this setting, <code>--pod-network-cidr=10.244.0.0/16</code> via a config file, i.e. <code>kubeadm init --config my_config.yaml</code>? I found a <a href="https://unofficial-kubernetes.readthedocs.io/en/latest/admin/kubeadm/" rel="nofollow noreferrer">sample config file template on an unofficial K8S documentation wiki</a>, but I can't seem to find any documentation at all that maps these command-line arguments to <code>kubeadm</code> to their <code>kubeadm_config.yaml</code> equivalents.</p>
<p><a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/" rel="nofollow noreferrer">There's also a document showing how I can create a baseline static pod definition/<code>yaml</code></a> via <code>kubeadm config print init-defaults &gt; kubeadm_config.yaml</code>, but again, no documentation that shows how to set <code>pod-network-cidr</code> by modifying and applying this <code>yaml</code> file (i.e. <code>kubeadm upgrade -f kubeadm_config.yaml</code>).</p>
<p><strong>Sample output of <code>kubeadm config view</code>:</strong></p>
<pre><code>apiServer:
  extraArgs:
    authorization-mode: Node,RBAC
  timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controllerManager: {}
dns:
  type: CoreDNS
etcd:
  local:
    dataDir: /var/lib/etcd
imageRepository: k8s.gcr.io
kind: ClusterConfiguration
kubernetesVersion: v1.15.4
networking:
  dnsDomain: cluster.local
  podSubnet: 10.244.0.0/16
  serviceSubnet: 10.96.0.0/12
scheduler: {}
</code></pre>
<hr />
<h1>Question 2:</h1>
<p>How can I do the above, but pass something like <code>--experimental-cluster-signing-duration=0h30m0s</code>? I'd like to experiment with tests involving manually/automatically renewing all <code>kubeadm</code>-related certs.</p>
<hr />

<p><strong>1.</strong> Accorindg to the <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/#config-file" rel="nofollow noreferrer">official documentation</a>:</p>

<blockquote>
  <p>It’s possible to configure <code>kubeadm init</code> with a configuration file
  instead of command line flags, and some more advanced features may
  only be available as configuration file options. This file is passed
  with the <code>--config</code> option.</p>
  
  <p>The default configuration can be printed out using the <code>kubeadm config print</code> <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-config/" rel="nofollow noreferrer">command</a>.</p>
  
  <p>It is recommended that you migrate your old v1beta1 configuration to v1beta2 using the <code>kubeadm config migrate</code> <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-config/" rel="nofollow noreferrer">command</a>.</p>
  
  <p>During <code>kubeadm init</code>, kubeadm uploads the ClusterConfiguration object
  to your cluster in a ConfigMap called kubeadm-config in the
  kube-system namespace. This configuration is then read during <code>kubeadm
  join</code>, <code>kubeadm reset</code> and <code>kubeadm upgrade</code>. To view this ConfigMap
  call <code>kubeadm config view</code>.</p>
  
  <p>You can use <code>kubeadm config print</code> to print the default configuration
  and <code>kubeadm config migrate</code> to convert your old configuration files
  to a newer version. <code>kubeadm config images list</code> and <code>kubeadm config images pull</code> can be used to list and pull the images that kubeadm
  requires.</p>
</blockquote>

<p>Subnets are defined by <code>--pod-network-cidr</code> argument in kubeadm OR by a config file such as the example below below:</p>

<pre><code>apiVersion: kubeadm.k8s.io/v1alpha3
kind: InitConfiguration
api:
  advertiseAddress: 0.0.0.0
  bindPort: 6443
kubernetesVersion: v1.12.1
---
apiVersion: kubeadm.k8s.io/v1alpha3
kind: ClusterConfiguration
networking:
  podSubnet: 192.168.0.0/24
</code></pre>

<p><strong>2.</strong> I was not able to find anything like this in the official documentation nor in other sources. </p>

<p>You instead can use <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/" rel="nofollow noreferrer">kube-controller-manager</a> to pass that kind of configuration.</p>

<p>Please let me know if that helped.</p>
