From 5d556861f3a6c3beb80f70f307eeeae678ac6e6a Mon Sep 17 00:00:00 2001 From: Dr Nic Williams Date: Tue, 29 Oct 2019 08:42:53 +1000 Subject: [PATCH] enable GCE as the cloud-provider for native volumes etc [fixes #496] --- docs/08-bootstrapping-kubernetes-controllers.md | 2 ++ docs/09-bootstrapping-kubernetes-workers.md | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/docs/08-bootstrapping-kubernetes-controllers.md b/docs/08-bootstrapping-kubernetes-controllers.md index 3d0cbca..a335745 100644 --- a/docs/08-bootstrapping-kubernetes-controllers.md +++ b/docs/08-bootstrapping-kubernetes-controllers.md @@ -82,6 +82,7 @@ ExecStart=/usr/local/bin/kube-apiserver \\ --authorization-mode=Node,RBAC \\ --bind-address=0.0.0.0 \\ --client-ca-file=/var/lib/kubernetes/ca.pem \\ + --cloud-provider=gce \\ --enable-admission-plugins=NamespaceLifecycle,NodeRestriction,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota \\ --etcd-cafile=/var/lib/kubernetes/ca.pem \\ --etcd-certfile=/var/lib/kubernetes/kubernetes.pem \\ @@ -127,6 +128,7 @@ Documentation=https://github.com/kubernetes/kubernetes [Service] ExecStart=/usr/local/bin/kube-controller-manager \\ --address=0.0.0.0 \\ + --cloud-provider=gce \\ --cluster-cidr=10.200.0.0/16 \\ --cluster-name=kubernetes \\ --cluster-signing-cert-file=/var/lib/kubernetes/ca.pem \\ diff --git a/docs/09-bootstrapping-kubernetes-workers.md b/docs/09-bootstrapping-kubernetes-workers.md index 6dd752d..fe4407d 100644 --- a/docs/09-bootstrapping-kubernetes-workers.md +++ b/docs/09-bootstrapping-kubernetes-workers.md @@ -212,6 +212,12 @@ EOF > The `resolvConf` configuration is used to avoid loops when using CoreDNS for service discovery on systems running `systemd-resolved`. +For the GCE cloud provider, we need to override the hostname it uses for each node so it matches with our certificates: + +``` +HOSTNAME_OVERRIDE=$(curl -sS http://metadata.google.internal/computeMetadata/v1/instance/name -H "Metadata-Flavor: Google") +``` + Create the `kubelet.service` systemd unit file: ``` @@ -224,9 +230,11 @@ Requires=containerd.service [Service] ExecStart=/usr/local/bin/kubelet \\ + --cloud-provider=gce \\ --config=/var/lib/kubelet/kubelet-config.yaml \\ --container-runtime=remote \\ --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock \\ + --hostname-override=$HOSTNAME_OVERRIDE \\ --image-pull-progress-deadline=2m \\ --kubeconfig=/var/lib/kubelet/kubeconfig \\ --network-plugin=cni \\