1f91cd1ee0
Add Usage Examples sections. Create KubeVirt Architecture section. Fix minor editorial issues. Fix grammar and formatting issues. Story: 2010931 Task: 50286 Change-Id: I6118d0af848d07f3764eeae5ea8467864c65fceb Signed-off-by: Elisamara Aoki Goncalves <elisamaraaoki.goncalves@windriver.com>
3.4 KiB
3.4 KiB
Virtual Machine Instance Replica Set
A tries to ensure that a specified number of replicas are running at any time. Meaning, a makes sure that a or a homogeneous set of is always up and ready.
Use VMIRS
The allows you to specify a Template in spec.template
.
It consists of ObjectMetadata
in
spec.template.metadata
, and a spec in
spec.template.spec
. The specification of the is equal to
the specification of the in the workload.
spec.replicas
can be used to specify how many replicas
are wanted. If unspecified, the default value is 1. This value can be
updated anytime. The controller reacts to the changes.
Example manifest for replicaset
:
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstanceReplicaSet
metadata:
name: testreplicaset
spec:
replicas: 3
selector:
matchLabels:
myvmi: myvmi
template:
metadata:
name: test
labels:
myvmi: myvmi
spec:
domain:
devices:
disks:
- disk:
name: containerdisk
resources:
requests:
memory: 64M
volumes:
- name: containerdisk
containerDisk:
image: kubevirt/cirros-container-disk-demo:latest
Configure Horizontal VM Autoscaler
[sysadmin@controller-0 ravi-test(keystone_admin)]$ cat hpa.yaml
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: test-hpa
spec:
scaleTargetRef:
kind: VirtualMachineInstanceReplicaSet
name: testreplicaset
apiVersion: kubevirt.io/v1
minReplicas: 3
maxReplicas: 5
targetCPUUtilizationPercentage: 50
---
Verify :
[sysadmin@controller-0 (keystone_admin)]$ kubectl describe horizontalpodautoscaler.autoscaling
Name: test-hpa
Namespace: default
Labels: <none>
Annotations: autoscaling.alpha.kubernetes.io/conditions:
[{"type":"AbleToScale","status":"True","lastTransitionTime":"2023-11-30T18:17:34Z","reason":"ScaleDownStabilized","message":"recent recomm...
autoscaling.alpha.kubernetes.io/current-metrics:
[\{"type":"Resource","resource":{"name":"cpu","currentAverageUtilization":1,"currentAverageValue":"2m"}}]
CreationTimestamp: Thu, 30 Nov 2023 19:17:19 +0100
Reference: VirtualMachineInstanceReplicaSet/testreplicaset
Target CPU utilization: 50%
Current CPU utilization: 1%
Min replicas: 3
Max replicas: 5
VirtualMachineInstanceReplicaSet pods: 3 current / 3 desired
Events: <none>
Note
Based on CPU usage in above example the autoscaler will scale up and
down the replicaset
.