- What's New
- Product Bulletin
- Service Overview
- Billing
- Getting Started
-
User Guide
-
UCS Clusters
- Overview
- Huawei Cloud Clusters
-
On-Premises Clusters
- Overview
- Service Planning for On-Premises Cluster Installation
- Registering an On-Premises Cluster
- Installing an On-Premises Cluster
- Managing an On-Premises Cluster
- Attached Clusters
- Multi-Cloud Clusters
- Single-Cluster Management
- Fleets
-
Cluster Federation
- Overview
- Enabling Cluster Federation
- Using kubectl to Connect to a Federation
- Upgrading a Federation
-
Workloads
- Workload Creation
-
Container Settings
- Setting Basic Container Information
- Setting Container Specifications
- Setting Container Lifecycle Parameters
- Setting Health Check for a Container
- Setting Environment Variables
- Configuring a Workload Upgrade Policy
- Configuring a Scheduling Policy (Affinity/Anti-affinity)
- Configuring Scheduling and Differentiation
- Managing a Workload
- ConfigMaps and Secrets
- Services and Ingresses
- MCI
- MCS
- DNS Policies
- Storage
- Namespaces
- Multi-Cluster Workload Scaling
- Adding Labels and Taints to a Cluster
- RBAC Authorization for Cluster Federations
- Image Repositories
- Permissions
-
Policy Center
- Overview
- Basic Concepts
- Enabling Policy Center
- Creating and Managing Policy Instances
- Example: Using Policy Center for Kubernetes Resource Compliance Governance
-
Policy Definition Library
- Overview
- k8spspvolumetypes
- k8spspallowedusers
- k8spspselinuxv2
- k8spspseccomp
- k8spspreadonlyrootfilesystem
- k8spspprocmount
- k8spspprivilegedcontainer
- k8spsphostnetworkingports
- k8spsphostnamespace
- k8spsphostfilesystem
- k8spspfsgroup
- k8spspforbiddensysctls
- k8spspflexvolumes
- k8spspcapabilities
- k8spspapparmor
- k8spspallowprivilegeescalationcontainer
- k8srequiredprobes
- k8srequiredlabels
- k8srequiredannotations
- k8sreplicalimits
- noupdateserviceaccount
- k8simagedigests
- k8sexternalips
- k8sdisallowedtags
- k8sdisallowanonymous
- k8srequiredresources
- k8scontainerratios
- k8scontainerrequests
- k8scontainerlimits
- k8sblockwildcardingress
- k8sblocknodeport
- k8sblockloadbalancer
- k8sblockendpointeditdefaultrole
- k8spspautomountserviceaccounttokenpod
- k8sallowedrepos
- Configuration Management
- Traffic Distribution
- Observability
- Container Migration
- Pipeline
- Error Codes
-
UCS Clusters
- Best Practices
-
API Reference
- Before You Start
- Calling APIs
-
API
- UCS Cluster
-
Fleet
- Adding a Cluster to a Fleet
- Removing a Cluster from a Fleet
- Registering a Fleet
- Deleting a Fleet
- Querying a Fleet
- Adding Clusters to a Fleet
- Updating Fleet Description
- Updating Permission Policies Associated with a Fleet
- Updating the Zone Associated with the Federation of a Fleet
- Obtaining the Fleet List
- Enabling Fleet Federation
- Disabling Cluster Federation
- Querying Federation Enabling Progress
- Creating a Federation Connection and Downloading kubeconfig
- Creating a Federation Connection
- Downloading Federation kubeconfig
- Permissions Management
- Using the Karmada API
- Appendix
-
FAQs
- About UCS
-
Billing
- How Is UCS Billed?
- What Status of a Cluster Will Incur UCS Charges?
- Why Am I Still Being Billed After I Purchase a Resource Package?
- How Do I Change the Billing Mode of a Cluster from Pay-per-Use to Yearly/Monthly?
- What Types of Invoices Are There?
- Can I Unsubscribe from or Modify a Resource Package?
-
Permissions
- How Do I Configure Access Permissions for Each Function of the UCS Console?
- What Can I Do If an IAM User Cannot Obtain Cluster or Fleet Information After Logging In to UCS?
- How Do I Restore ucs_admin_trust I Deleted or Modified?
- What Can I Do If I Cannot Associate the Permission Policy with a Fleet or Cluster?
- How Do I Clear RBAC Resources After a Cluster Is Unregistered?
- Policy Center
-
Fleets
- What Can I Do If Cluster Federation Verification Fails to Be Enabled for a Fleet?
- What Can I Do If an Abnormal, Federated Cluster Fails to Be Removed from the Fleet?
- What Can I Do If an Nginx Ingress Is in the Unready State After Being Deployed?
- What Can I Do If "Error from server (Forbidden)" Is Displayed When I Run the kubectl Command?
- Huawei Cloud Clusters
- Attached Clusters
-
On-Premises Clusters
- What Can I Do If an On-Premises Cluster Fails to Be Connected?
- How Do I Manually Clear Nodes of an On-Premises Cluster?
- How Do I Downgrade a cgroup?
- What Can I Do If the VM SSH Connection Times Out?
- How Do I Expand the Disk Capacity of the CIA Add-on in an On-Premises Cluster?
- What Can I Do If the Cluster Console Is Unavailable After the Master Node Is Shut Down?
- What Can I Do If a Node Is Not Ready After Its Scale-Out?
- How Do I Update the CA/TLS Certificate of an On-Premises Cluster?
- What Can I Do If an On-Premises Cluster Fails to Be Installed?
- Multi-Cloud Clusters
-
Cluster Federation
- What Can I Do If the Pre-upgrade Check of the Cluster Federation Fails?
- What Can I Do If a Cluster Fails to Be Added to a Federation?
- What Can I Do If Status Verification Fails When Clusters Are Added to a Federation?
- What Can I Do If an HPA Created on the Cluster Federation Management Plane Fails to Be Distributed to Member Clusters?
- What Can I Do If an MCI Object Fails to Be Created?
- What Can I Do If I Fail to Access a Service Through MCI?
- What Can I Do If an MCS Object Fails to Be Created?
- What Can I Do If an MCS or MCI Instance Fails to Be Deleted?
- Traffic Distribution
- Container Intelligent Analysis
- General Reference
Copied.
Creating a CronFederatedHPA to Scale Pods at Regular Intervals
This section describes how you can create a CronFederatedHPA so that pods in workloads are automatically scaled in or out at regular intervals.
Before creating a CronFederatedHPA, you must have learnt the basic working principle and concepts of CronFederatedHPA (How CronFederatedHPA Works). To know the differences between the FederatedHPA and CronFederatedHPA, see Overview.
Constraints
CronFederatedHPA can be configured only for clusters 1.19 or later.
Creating a CronFederatedHPA
Using the console
- Log in to the UCS console and choose Fleets in the navigation pane.
- Click the name of the fleet with federation enabled.
- Choose Workload Scaling in the navigation pane and click the Scheduled Policies tab. Then click Create Scheduled Policy in the upper right corner.
- Configure parameters for the CronFederatedHPA by referring to Table 1.
Table 1 Basic parameters Parameter
Description
Policy Name
Enter a name for the CronFederatedHPA.
Namespace
Select the namespace for the workload for which you want to configure automatic scaling.
Object
Select Workloads or Metric-based Policy.
- Workloads: Select or create a workload you will associate the policy with. For details, see Creating a Workload.
- Metric-based Policy: Select an existing metric-based policy or click Create Metric-based Policy on the right to create one. For details, see Creating a FederatedHPA.
- Click Add Rule in Policy Settings. In the displayed dialog box, configure parameters by referring to Table 2.
Table 2 Parameters for adding a rule Parameter
Description
Rule Name
Enter a name for the CronFederatedHPA.
Expected Copies
Enter the desired number of pods scaled when the CronFederatedHPA is triggered.
Triggered
Select Hourly, Daily, Weekly, Monthly, Yearly, or Cron.
- Hourly: a specific minute in an hour when the policy is executed. For example, if you select 5, the policy is executed at the fifth minute of every hour.
- Daily: a specific minute every day when the policy is executed.
- Weekly: a specific minute on a day of each week when the policy is executed.
- Monthly: a specific minute on a day of each month when the policy is executed.
- Yearly: a specific minute on a day of a month in each year when the policy is executed.
- Cron:
Cron expression syntax:
┌───────────── Minute (0 to 59) │ ┌─────────── Hour (0 to 23) │ │ ┌────────── A day in a month (1 to 31) │ │ │ ┌──────── Month (1 to 12) │ │ │ │ ┌─────── A day in a week (0 to 6) │ │ │ │ │ │ │ │ │ │ * * * * *
For example, 0 0 13 * 5 indicates that a task is started at 00:00 on every Friday and the 13th day of each month.
Time Zone
Select Shanghai or Singapore.
- Click OK and then click Create.
In the displayed policy list, you can view the policy details.
Using kubectl
- Use kubectl to connect to the federation. For details, see Using kubectl to Connect to a Federation.
- Create and edit a cfhpa.yaml file.
vi cfhpa.yaml
For details about the parameters in this file, see Table 3. In this example, the CronFederatedHPA named cron-federated-hpa is used for the test workload and contains two rules (Scale-Up and Scale-Down) for scheduled scaling. Scale-Up specifies that 10 pods are scaled out at 8:30 daily, and Scale-Down specifies that 5 pods are scaled in at 21:00 daily.
apiVersion: autoscaling.karmada.io/v1alpha1 kind: CronFederatedHPA metadata: name: cron-federated-hpa # CronFederatedHPA name spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment # Select Deployment or FederatedHPA. name: test # Name of the workload or FederatedHPA rules: - name: "Scale-Up" # Rule name schedule: 30 08 * * * # Time when the policy is triggered targetReplicas: 10 # Desired number of pods, which is a non-negative integer timeZone: Asia/Shanghai # Time zone - name: "Scale-Down" # Rule name schedule: 0 21 * * * # Time when the policy is triggered targetReplicas: 5 # Desired number of pods, which is a non-negative integer timeZone: Asia/Shanghai # Time zone
Table 3 Key parameters Parameter
Mandatory
Type
Description
kind
Yes
String
Select Deployment or FederatedHPA.
- Deployment: The CronFederatedHPA is used separately.
- FederatedHPA: Both FederatedHPA and CronFederatedHPA are used.
name
Yes
String
Enter the rule name of 1 to 32 characters in the CronFederatedHPA.
schedule
Yes
String
Time when the policy is triggered. Cron expression syntax:
┌───────────── Minute (0 to 59) │ ┌─────────── Hour (0 to 23) │ │ ┌────────── A day in a month (1 to 31) │ │ │ ┌──────── Month (1 to 12) │ │ │ │ ┌─────── A day in a week (0 to 6) │ │ │ │ │ │ │ │ │ │ * * * * *
For example, 0 0 13 * 5 indicates that a task is started at 00:00 on every Friday and the 13th day of each month.
targetReplicas
Yes
String
Enter the desired number of pods scaled when the CronFederatedHPA is triggered.
timeZone
Yes
String
Select Shanghai or Singapore.
- Shanghai: Asia/Shanghai
- Singapore: Asia/Singapore
- Create a CronFederatedHPA.
kubectl apply -f cfhpa.yaml
If information similar to the following is displayed, the policy has been created:
CronFederatedHPA.autoscaling.karmada.io/cron-federated-hpa created
You can run the following commands to check the workload scaling:
- kubectl get deployments: checks the current number of pods in a workload.
- kubectl describe cronfederatedhpa cron-federated-hpa: views scaling events (latest three records) of the CronFederatedHPA.
You can run the following commands to manage CronFederatedHPA cron-federated-hpa (replaced with the actual name):
- kubectl get cronfederatedhpa cron-federated-hpa: obtains the CronFederatedHPA.
- kubectl edit cronfederatedhpa cron-federated-hpa: updates the CronFederatedHPA.
- kubectl delete cronfederatedhpa cron-federated-hpa: deletes the CronFederatedHPA.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot