Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Application Backup

Updated on 2024-12-18 GMT+08:00

Application migration from clusters in an on-premises IDC consists of two steps: application backup and application migration. That is, applications in the clusters in an on-premises IDC are backed up and then migrated to the destination cluster through data restoration.

k8clone is a simple Kubernetes metadata cloning tool. It can save Kubernetes metadata (objects) as a local package and restore the metadata to the destination cluster (Huawei Cloud cluster or on-premises cluster of UCS). In this way, applications can be migrated from clusters in an on-premises data center to the cloud.

NOTICE:

Back up data during off-peak hours.

Prerequisites

Ensure that services (data not in the cluster, such as images, storage, and databases) on which cloud native applications depend have been migrated.

How k8clone Backs Up Data

Data backup process:

Figure 1 Data backup process

k8clone Usage for Backup

NOTE:

k8clone can run on Linux (x86 and Arm) and Windows. The usage is similar in both environments. This section uses the Linux (x86) environment as an example.

If Linux (Arm) or Windows is used, replace k8clone-linux-amd64 in the following command with k8clone-linux-arm64 or k8clone-windows-amd64.exe.

Run ./k8clone-linux-amd64 backup -h in the directory where k8clone is located to learn about its usage.

  • -k, --kubeconfig: specifies the location of the kubeconfig file of kubectl. The default value is $HOME/.kube/config. The kubeconfig file is used to configure access to the Kubernetes cluster. The kubeconfig file contains the authentication credentials and endpoints (access addresses) required for accessing and registering the Kubernetes cluster. For details, see the Kubernetes documentation.
  • -s, --api-server: Kubernetes API Server URL. The default value is "".
  • -q, --context: Kubernetes Configuration Context. The default value is "".
  • -n, --namespace: backs up cloud native applications of a specified namespace. Multiple namespaces are separated by commas (,), for example, ns1,ns2,ns3. The default value is "", indicating that the entire cluster is backed up.
  • -e, --exclude-namespaces: excludes the backup of objects of a specified namespace. This parameter cannot be used together with --namespace.
  • -x, --exclude-kind: excludes the backup of a specified resource type.
  • -i, --include-kind: specifies the backup of a resource type.
  • -y, --exclude-object: excludes the backup of a specified resource object.
  • -z, --include-object: specifies the backup of a resource object.
  • -w, --exclude-having-owner-ref: excludes the backup of resource objects with ownerReferences. The default value is false. The equal sign (=) must be added when a Boolean parameter is transferred, for example, -w=true. -w true does not take effect, and the default value will be used.
  • -d, --local-dir: path for storing backup data. The default value is the k8clone-dump folder in the current directory.
$ ./k8clone-linux-amd64 backup -h
Backup Workload Data as yaml files

Usage:
    k8clone backup [flags]

Flags:
   -s, --api-server string            Kubernetes api-server url
   -q, --context string               Kubernetes configuration context
   -w, --exclude-having-owner-ref     Exclude all objects having an Owner Reference. The default value is false. The equal sign (=) must be added when a Boolean parameter is transferred, for example, -w=true. -w  true does not take effect, and the default value will be used.
   -x, --exclude-kind strings         Resource kind to exclude. Eg. 'deployment'
   -i, --include-kind strings         Ressource kind to include. Eg. 'deployment'
   -e, --exclude-namespaces strings   Namespaces to exclude. Eg. 'temp.*' as regexes. This collects all namespaces and then filters them. Don't use it with the namespace flag.
   -y, --exclude-object strings       Object to exclude. The form is '<kind>:<namespace>/<name>',namespace can be empty when object is not namespaced. Eg. 'configmap:kube-system/kube-dns'
   -z, --include-object strings       Object to include. The form is '<kind>:<namespace>/<name>',namespace can be empty when object is not namespaced. Eg. 'configmap:kube-system/kube-dns' 
   -h, --help                         help for backup
   -k, --kubeconfig string            The kubeconfig of k8s cluster's. Default is the $HOME/.kube/config. 
   -d, --local-dir string             Where to dump yaml files (default "./k8clone-dump")
   -n, --namespace string             Only dump objects from this namespace

Examples:

  • Backs up objects of the entire cluster. The default path is the k8clone-dump folder in the current directory.

    ./k8clone-linux-amd64 backup

  • Backs up objects of the entire cluster and specifies the path for storing backup data.

    ./k8clone-linux-amd64 backup -d ./xxxx

  • Backs up objects of a specified namespace.

    ./k8clone-linux-amd64 backup -n default

  • Excludes the backup of objects of a specified namespace.

    ./k8clone-linux-amd64 backup -e kube-system,kube-public,kube-node-lease

  • Excludes the backup of specified resource types.

    ./k8clone-linux-amd64 backup -x endpoints,endpointslice

  • Specifies the backup of resource types.

    ./k8clone-linux-amd64 backup -i rolebinding

  • Excludes the backup of specified resource objects.

    ./k8clone-linux-amd64 backup -y configmap:kube-system/kube-dns

  • Specifies the backup of resource objects.

    ./k8clone-linux-amd64 backup -z configmap:kube-system/kube-dns

  • Excludes the backup of resource objects with ownerReferences.

    ./k8clone-linux-amd64 backup -w=true

Procedure

  1. Connect to the source cluster using kubectl. For details, see Connecting to a Cluster Using kubectl.
  2. Go to the directory where k8clone is located and run the backup command to back up data to a local directory and compress the data into a package.

    The examples in k8clone Usage for Backup provide several common backup methods. You can select a method as required or customize one.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback