kubespray/roles/download/templates/kubeadm-images.yaml.j2

26 lines
709 B
Plaintext
Raw Normal View History

apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
nodeRegistration:
criSocket: {{ cri_socket }}
---
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
imageRepository: {{ kube_image_repo }}
kubernetesVersion: {{ kube_version }}
Explicitely set etcd endpoint in kubeadm-images.yaml (#4063) Currently, the task `container_download | download images for kubeadm config images` fetches etcd image even though it's not required (etcd is bootstrapped by kubespray, not kubeadm). `kubeadm-images.yaml` is only a subset of `kubeadm-config.yaml`, therefore ``kubeadm config images pull` will try to get all this list (including etcd) ``` # kubeadm config images list --config /etc/kubernetes/kubeadm-images.yaml k8s.gcr.io/kube-apiserver:v1.13.2 k8s.gcr.io/kube-controller-manager:v1.13.2 k8s.gcr.io/kube-scheduler:v1.13.2 k8s.gcr.io/kube-proxy:v1.13.2 k8s.gcr.io/pause:3.1 k8s.gcr.io/etcd:3.2.24 k8s.gcr.io/coredns:1.2.6 ``` When using the `kubeadm-config.yaml` though, it doesn't list etcd image: ``` # kubeadm config images list --config /etc/kubernetes/kubeadm-config.yaml k8s.gcr.io/kube-apiserver:v1.13.2 k8s.gcr.io/kube-controller-manager:v1.13.2 k8s.gcr.io/kube-scheduler:v1.13.2 k8s.gcr.io/kube-proxy:v1.13.2 k8s.gcr.io/pause:3.1 k8s.gcr.io/coredns:1.2.6 ``` This change just adds the etcd endpoints in the `kubeadm-images.yaml` to give a hint to kubeadm it doesn't need etcd image for its boostrapping as etcd is "external". I confess it is a ugly hack, a better way would be to use a single `kubeadm-config.yaml` for both tasks, but they are triggered by different roles (`kubeadm-images.yaml` is used by download, `kubeadm-config.yaml` by kubernetes/master) at different steps and I didn't want to refactor too many things to prevent breakage. This is specially useful for offline installation where a whitelist of container images is mirrored on a local private container registry. `k8s.gcr.io/etcd` and `quay.io/coreos/etcd` are two different repositories hosting the same images but using *different tags*! * coreos/etcd:v3.2.24 * k8s.gcr.io/etcd:3.2.24 (note the missing 'v' in the tag name)
2019-02-14 04:44:12 +08:00
etcd:
{% if etcd_deployment_type == "kubeadm" %}
local:
imageRepository: "{{ etcd_image_repo | regex_replace("/etcd$","") }}"
imageTag: "{{ etcd_image_tag }}"
{% else %}
Explicitely set etcd endpoint in kubeadm-images.yaml (#4063) Currently, the task `container_download | download images for kubeadm config images` fetches etcd image even though it's not required (etcd is bootstrapped by kubespray, not kubeadm). `kubeadm-images.yaml` is only a subset of `kubeadm-config.yaml`, therefore ``kubeadm config images pull` will try to get all this list (including etcd) ``` # kubeadm config images list --config /etc/kubernetes/kubeadm-images.yaml k8s.gcr.io/kube-apiserver:v1.13.2 k8s.gcr.io/kube-controller-manager:v1.13.2 k8s.gcr.io/kube-scheduler:v1.13.2 k8s.gcr.io/kube-proxy:v1.13.2 k8s.gcr.io/pause:3.1 k8s.gcr.io/etcd:3.2.24 k8s.gcr.io/coredns:1.2.6 ``` When using the `kubeadm-config.yaml` though, it doesn't list etcd image: ``` # kubeadm config images list --config /etc/kubernetes/kubeadm-config.yaml k8s.gcr.io/kube-apiserver:v1.13.2 k8s.gcr.io/kube-controller-manager:v1.13.2 k8s.gcr.io/kube-scheduler:v1.13.2 k8s.gcr.io/kube-proxy:v1.13.2 k8s.gcr.io/pause:3.1 k8s.gcr.io/coredns:1.2.6 ``` This change just adds the etcd endpoints in the `kubeadm-images.yaml` to give a hint to kubeadm it doesn't need etcd image for its boostrapping as etcd is "external". I confess it is a ugly hack, a better way would be to use a single `kubeadm-config.yaml` for both tasks, but they are triggered by different roles (`kubeadm-images.yaml` is used by download, `kubeadm-config.yaml` by kubernetes/master) at different steps and I didn't want to refactor too many things to prevent breakage. This is specially useful for offline installation where a whitelist of container images is mirrored on a local private container registry. `k8s.gcr.io/etcd` and `quay.io/coreos/etcd` are two different repositories hosting the same images but using *different tags*! * coreos/etcd:v3.2.24 * k8s.gcr.io/etcd:3.2.24 (note the missing 'v' in the tag name)
2019-02-14 04:44:12 +08:00
external:
endpoints:
{% for endpoint in etcd_access_addresses.split(',') %}
- {{ endpoint }}
{% endfor %}
{% endif %}
dns:
type: CoreDNS
imageRepository: {{ coredns_image_repo | regex_replace('/coredns(?!/coredns).*$','') }}
imageTag: {{ coredns_image_tag }}