mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Use a persistent volume for the docker registry.
This commit is contained in:
parent
7129d477d3
commit
14b554cef6
16
cluster/addons/registry/registry-pv.yaml.in
Normal file
16
cluster/addons/registry/registry-pv.yaml.in
Normal file
@ -0,0 +1,16 @@
|
||||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-system-kube-registry-pv
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
{% if pillar.get('cluster_registry_disk_type', '') == 'gce' %}
|
||||
capacity:
|
||||
storage: {{ pillar['cluster_registry_disk_size'] }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
gcePersistentDisk:
|
||||
pdName: "{{ pillar['cluster_registry_disk_name'] }}"
|
||||
fsType: "ext4"
|
||||
{% endif %}
|
13
cluster/addons/registry/registry-pvc.yaml.in
Normal file
13
cluster/addons/registry/registry-pvc.yaml.in
Normal file
@ -0,0 +1,13 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: kube-registry-pvc
|
||||
namespace: kube-system
|
||||
labels:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ pillar['cluster_registry_disk_size'] }}
|
@ -41,13 +41,5 @@ spec:
|
||||
# TODO: use a persistent volume claim
|
||||
volumes:
|
||||
- name: image-store
|
||||
{%- if pillar.get('cluster_registry_disk', '') != '' -%}
|
||||
{%- for disk in pillar['cluster_registry_disk'].keys() %}
|
||||
{{ disk }}:
|
||||
{%- for k, v in pillar['cluster_registry_disk'][disk].items() %}
|
||||
{{k}}: {{v}}
|
||||
{%- endfor -%}
|
||||
{%- endfor -%}
|
||||
{%- else %}
|
||||
emptyDir: {}
|
||||
{%- endif -%}
|
||||
persistentVolumeClaim:
|
||||
claimName: kube-registry-pvc
|
@ -81,7 +81,7 @@ DNS_REPLICAS=1
|
||||
ENABLE_CLUSTER_REGISTRY="${KUBE_ENABLE_CLUSTER_REGISTRY:-true}"
|
||||
CLUSTER_REGISTRY_DISK="${CLUSTER_REGISTRY_PD:-${INSTANCE_PREFIX}-kube-system-kube-registry}"
|
||||
CLUSTER_REGISTRY_DISK_SIZE="${CLUSTER_REGISTRY_DISK_SIZE:-200GB}"
|
||||
CLUSTER_REGISTRY_DISK_TYPE="${CLUSTER_REGISTRY_DISK_TYPE:-pd-standard}"
|
||||
CLUSTER_REGISTRY_DISK_TYPE_GCE="${CLUSTER_REGISTRY_DISK_TYPE_GCE:-pd-standard}"
|
||||
|
||||
# Optional: Install Kubernetes UI
|
||||
ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
|
||||
|
@ -86,7 +86,7 @@ DNS_REPLICAS=1
|
||||
ENABLE_CLUSTER_REGISTRY="${KUBE_ENABLE_CLUSTER_REGISTRY:-true}"
|
||||
CLUSTER_REGISTRY_DISK="${CLUSTER_REGISTRY_DISK:-${INSTANCE_PREFIX}-kube-system-kube-registry}"
|
||||
CLUSTER_REGISTRY_DISK_SIZE="${CLUSTER_REGISTRY_DISK_SIZE:-200GB}"
|
||||
CLUSTER_REGISTRY_DISK_TYPE="${CLUSTER_REGISTRY_DISK_TYPE:-pd-standard}"
|
||||
CLUSTER_REGISTRY_DISK_TYPE_GCE="${CLUSTER_REGISTRY_DISK_TYPE_GCE:-pd-standard}"
|
||||
|
||||
# Optional: Install Kubernetes UI
|
||||
ENABLE_CLUSTER_UI="${KUBE_ENABLE_CLUSTER_UI:-true}"
|
||||
|
@ -307,10 +307,9 @@ EOF
|
||||
# TODO: Replace this with a persistent volume (and create it).
|
||||
if [[ "${ENABLE_CLUSTER_REGISTRY}" == true && -n "${CLUSTER_REGISTRY_DISK}" ]]; then
|
||||
cat <<EOF >>/srv/salt-overlay/pillar/cluster-params.sls
|
||||
cluster_registry_disk:
|
||||
gcePersistentDisk:
|
||||
pdName: ${CLUSTER_REGISTRY_DISK}
|
||||
fsType: ext4
|
||||
cluster_registry_disk_type: gce
|
||||
cluster_registry_disk_size: ${CLUSTER_REGISTRY_DISK_SIZE//GB/Gi}
|
||||
cluster_registry_disk_name: ${CLUSTER_REGISTRY_DISK}
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ ELASTICSEARCH_LOGGING_REPLICAS: $(yaml-quote ${ELASTICSEARCH_LOGGING_REPLICAS:-}
|
||||
ENABLE_CLUSTER_DNS: $(yaml-quote ${ENABLE_CLUSTER_DNS:-false})
|
||||
ENABLE_CLUSTER_REGISTRY: $(yaml-quote ${ENABLE_CLUSTER_REGISTRY:-false})
|
||||
CLUSTER_REGISTRY_DISK: $(yaml-quote ${CLUSTER_REGISTRY_DISK})
|
||||
CLUSTER_REGISTRY_DISK_SIZE: $(yaml-quote ${CLUSTER_REGISTRY_DISK_SIZE})
|
||||
DNS_REPLICAS: $(yaml-quote ${DNS_REPLICAS:-})
|
||||
DNS_SERVER_IP: $(yaml-quote ${DNS_SERVER_IP:-})
|
||||
DNS_DOMAIN: $(yaml-quote ${DNS_DOMAIN:-})
|
||||
|
@ -648,7 +648,7 @@ function kube-up {
|
||||
gcloud compute disks create "${CLUSTER_REGISTRY_DISK}" \
|
||||
--project "${PROJECT}" \
|
||||
--zone "${ZONE}" \
|
||||
--type "${CLUSTER_REGISTRY_DISK_TYPE}" \
|
||||
--type "${CLUSTER_REGISTRY_DISK_TYPE_GCE}" \
|
||||
--size "${CLUSTER_REGISTRY_DISK_SIZE}" &
|
||||
fi
|
||||
|
||||
|
@ -92,7 +92,24 @@ addon-dir-create:
|
||||
|
||||
/etc/kubernetes/addons/registry/registry-rc.yaml:
|
||||
file.managed:
|
||||
- source: salt://kube-addons/registry/registry-rc.yaml.in
|
||||
- source: salt://kube-addons/registry/registry-rc.yaml
|
||||
- user: root
|
||||
- group: root
|
||||
- file_mode: 644
|
||||
- makedirs: True
|
||||
|
||||
/etc/kubernetes/addons/registry/registry-pv.yaml:
|
||||
file.managed:
|
||||
- source: salt://kube-addons/registry/registry-pv.yaml.in
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
- file_mode: 644
|
||||
- makedirs: True
|
||||
|
||||
/etc/kubernetes/addons/registry/registry-pvc.yaml:
|
||||
file.managed:
|
||||
- source: salt://kube-addons/registry/registry-pvc.yaml.in
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
|
@ -470,12 +470,14 @@ function update-addons() {
|
||||
# be careful, reconcile-objects uses global variables
|
||||
reconcile-objects ${addon_path} ReplicationController "-" &
|
||||
|
||||
# We don't expect service names to be versioned, so
|
||||
# we match entire name, ignoring version suffix.
|
||||
# We don't expect names to be versioned for the following kinds, so
|
||||
# we match the entire name, ignoring version suffix.
|
||||
# That's why we pass an empty string as the version separator.
|
||||
# If the service description differs on disk, the service should be recreated.
|
||||
# If the description differs on disk, the object should be recreated.
|
||||
# This is not implemented in this version.
|
||||
reconcile-objects ${addon_path} Service "" &
|
||||
reconcile-objects ${addon_path} PersistentVolume "" &
|
||||
reconcile-objects ${addon_path} PersistentVolumeClaim "" &
|
||||
|
||||
wait-for-jobs
|
||||
if [[ $? -eq 0 ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user