Kubernetes集群的Kubeadm初始化配置

时间:2018-10-20 21:20:46

标签: kubernetes kubectl kubeadm

使用kubeadm init,使用默认配置选项初始化控制平面,是否有办法查看它对控制平面所做的默认值/配置,以及如何查看该配置文件以及其位置存储。

2 个答案:

答案 0 :(得分:1)

找到命令:(以防万一有人需要它)

C02W84XMHTD5:~ iahmad$ kubectl get configMap kubeadm-config -o yaml --namespace=kube-system
apiVersion: v1
data:
  MasterConfiguration: |
    api:
      advertiseAddress: 192.168.64.4
      bindPort: 8443
      controlPlaneEndpoint: localhost
    apiServerExtraArgs:
      admission-control: Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota
    auditPolicy:
      logDir: /var/log/kubernetes/audit
      logMaxAge: 2
      path: ""
    authorizationModes:
    - Node
    - RBAC
    certificatesDir: /var/lib/minikube/certs/
    cloudProvider: ""
    criSocket: /var/run/dockershim.sock
    etcd:
      caFile: ""
      certFile: ""
      dataDir: /data/minikube
      endpoints: null
      image: ""
      keyFile: ""
    imageRepository: k8s.gcr.io
    kubeProxy:
      config:
        bindAddress: 0.0.0.0
        clientConnection:
          acceptContentTypes: ""
          burst: 10
          contentType: application/vnd.kubernetes.protobuf
          kubeconfig: /var/lib/kube-proxy/kubeconfig.conf
          qps: 5
        clusterCIDR: ""
        configSyncPeriod: 15m0s
        conntrack:
          max: null
          maxPerCore: 32768
          min: 131072
          tcpCloseWaitTimeout: 1h0m0s
          tcpEstablishedTimeout: 24h0m0s
        enableProfiling: false
        healthzBindAddress: 0.0.0.0:10256
        hostnameOverride: ""
        iptables:
          masqueradeAll: false
          masqueradeBit: 14
          minSyncPeriod: 0s
          syncPeriod: 30s
        ipvs:
          minSyncPeriod: 0s
          scheduler: ""
          syncPeriod: 30s
        metricsBindAddress: 127.0.0.1:10249
        mode: ""
        nodePortAddresses: null
        oomScoreAdj: -999
        portRange: ""
        resourceContainer: /kube-proxy
        udpIdleTimeout: 250ms
    kubeletConfiguration: {}
    kubernetesVersion: v1.10.0
    networking:
      dnsDomain: cluster.local
      podSubnet: ""
      serviceSubnet: 10.96.0.0/12
    noTaintMaster: true
    nodeName: minikube
    privilegedPods: false
    token: ""
    tokenGroups:
    - system:bootstrappers:kubeadm:default-node-token
    tokenTTL: 24h0m0s
    tokenUsages:
    - signing
    - authentication
    unifiedControlPlaneImage: ""

答案 1 :(得分:0)

kubeadm config print init-defaults(参见join-defaults)将显示默认值:

$ kubeadm config print init-defaults
apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:
- groups:
  - system:bootstrappers:kubeadm:default-node-token
  token: abcdef.0123456789abcdef
  ttl: 24h0m0s
  usages:
  - signing
  - authentication
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: 1.2.3.4
  bindPort: 6443
nodeRegistration:
  criSocket: /var/run/dockershim.sock
  name: k1.london.vultr
  taints:
  - effect: NoSchedule
    key: node-role.kubernetes.io/master
---
apiServer:
  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.16.0
networking:
  dnsDomain: cluster.local
  serviceSubnet: 10.96.0.0/12
scheduler: {}

kubeadm v1.16.0)

据我所知,这些是内置默认值,并且没有可覆盖的默认值文件,即要提供其他配置文件,必须传递--config=<file>