Warm up the MOSK management cache
TechPreview
This section describes how to speed up deployment and update process of
MOSK clusters, which usually do not have access to the
internet and consume artifacts from a management cluster using the
mcc-cache service.
By default, after auto-update of a management cluster,
before each MOSK cluster deployment or update, mcc-cache
downloads the required list of images, thus slowing down the process.
Using the CacheWarmupRequest resource, you can predownload (warm up)
a list of images included in a given set of Cluster releases into the
mcc-cache service only once per release for further usage on all
MOSK clusters.
After a successful cache warm-up, the object of the CacheWarmupRequest
resource is automatically deleted from the cluster and cache remains for
MOSK clusters deployment or update until next auto-update
of the management cluster.
Caution
If the disk space for cache runs out, the cache for the oldest object is evicted. To avoid running out of space in the cache, verify and adjust its size before each cache warm-up.
Requirements
Cache warm-up requires a lot of disk storage, it may take up to 100% of disk
space. Therefore, make sure to have enough space for storing cached objects
on each node of the management cluster before creating the
CacheWarmupRequest resource. The following example contains minimal
required values for the cache size for the management cluster:
Cluster release |
Minimal value in GiB |
|---|---|
MOSK Cluster release with one OpenStack version |
50 |
MOSK Cluster release with an OpenStack version upgrade
from |
120 |
Note
If openstackReleases is not set in the CacheWarmupRequest
object, no OpenStack images are warmed up, not even the OpenStack Controller
image. Therefore, make sure to set openstackReleases explicitly.
For details about the lvp partition requirements, see
Default configuration of the host system storage.
Increase cache size for mcc-cache
After you calculate the disk size for warming up cache depending on your
cluster settings and minimal cache warm-up requirements, configure the size of
cache in the Cluster object of your cluster.
In the spec:providerSpec:value:kaas:regionalHelmReleases: section of the
management Cluster object, add the following snippet to the mcc-cache
entry with the required size value in GiB:
nginx:
cacheSize: 100
kubectl --kubeconfig <pathToManagementClusterKubeconfig> edit cluster <clusterName>
Configuration example:
spec:
providerSpec:
value:
kaas:
regionalHelmReleases:
- name: mcc-cache
values:
nginx:
cacheSize: 100
Note
The cacheSize parameter is set in GiB.
Note
The cacheSize parameter only increases the NGINX cache size and
does not change the size of the related Persistent Volume for the
mcc-cache service. Make sure to have enough capacity in the related
lvp partition on the management cluster nodes. For disk space
requirements, see MOSK cluster hardware requirements.
Warm up cache using CLI
After you increase the size of cache on the cluster as described in
Increase cache size for mcc-cache, create the CacheWarmupRequest object in the
Kubernetes API.
Caution
Create CacheWarmupRequest objects only on the management
cluster.
To warm up cache using CLI:
Identify the latest available Cluster releases to use for deployment of new clusters and update of existing clusters:
kubectl --kubeconfig <pathToManagementClusterKubeconfig> get kaasreleases -l=kaas.mirantis.com/active="true" -o=json | jq -r '.items[].spec.supportedClusterReleases[] | select(.availableUpgrades | length == 0) | .name'
Example of system response:
mke-20-0-0-3-7-24 mosk-21-0-0-25-2
On the management cluster, create a
.yamlfile for theCacheWarmupRequestobject using the following example:apiVersion: kaas.mirantis.com/v1alpha1 kind: CacheWarmupRequest metadata: name: example-cluster-name namespace: default spec: clusterReleases: - mke-20-0-0-3-7-24 - mosk-21-0-0-25-2 openstackReleases: - epoxy fetchRequestTimeout: 30m clientsPerEndpoint: 2 openstackOnly: false
In this example:
The
CacheWarmupRequestobject is created for a management cluster namedexample-cluster-name.The
CacheWarmupRequestobject is created in the only alloweddefault{{ product_name_abbr }} management project.Two Cluster releases
mosk-21-0-0-25-2andmke-20-0-0-3-7-24will be predownloaded.For
mosk-21-0-0-25-2, only images related to the OpenStack versionEpoxywill be predownloaded.Maximum time-out for a single request to download a single artifact is 30 minutes.
Two parallel workers will fetch artifacts per each
mcc-cacheservice endpoint.All artifacts will be fetched, not only those related to OpenStack.
For details about the
CacheWarmupRequestobject, see CacheWarmupRequest resource.Apply the object to the cluster:
kubectl --kubeconfig <pathToManagementKubeconfig> apply -f <pathToFile>
Once done, during deployment and update of MOSK clusters, MOSK management uses cached artifacts from the
mcc-cacheservice to facilitate and speed up the procedure.
When a new MOSK release becomes available and the management cluster auto-updates to a new release, repeat the above steps to predownload a new set of artifacts for MOSK clusters.