Skip to content

Instantly share code, notes, and snippets.

@mowings
Last active May 20, 2024 04:56
Show Gist options
  • Save mowings/9d2ed2994824cb9d40c1071b1603b060 to your computer and use it in GitHub Desktop.
Save mowings/9d2ed2994824cb9d40c1071b1603b060 to your computer and use it in GitHub Desktop.
Example kubeadm config file

Since there's no (or not many) real examples of valid kubeadm config files out there (for use with kubeadm --config <file>), here is an example. This version declares a control plane endpoint, the proxy for an HA setup, and also includes a KubeProxyConfiguation to tell kube-proxy to use ipvs.

You can leave off the controlPlaneEndpoint (which points to the HA proxy ip:port) if you are not running in HA mode, and you can omit the KubeProxyConfiguration if you are satisfied with using the default of iptables for the proxy mode.

To initalize an HA setup using this file with kubeadm, you can execute:

kubeadm --config kubeadm.yml --upload-certs

If you are not running multile masters, you can omit the upload-certs argument and remove the controlPlaneEndpoint from the config file.

apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: v1.16.4
apiServer:
  extraArgs:
    authorization-mode: Node,RBAC
  timeoutForControlPlane: 4m0s
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: 10.98.83.105:6443
dns:
  type: CoreDNS
etcd:
  local:
    dataDir: /var/lib/etcd
imageRepository: k8s.gcr.io
networking:
  dnsDomain: cluster.local
  podSubnet: 10.244.0.0/16
  serviceSubnet: 10.96.0.0/12
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: ipvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment