Easily Switch Between Product Types

You can click the drop-down list box to switch between different product types.

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
DataArts Fabric
IoT
IoT Device Access
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
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
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
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
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 (CCI)
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
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
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
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Kubernetes

Updated on 2025-06-26 GMT+08:00

What Is Kubernetes?

Kubernetes is a containerized application software system that can be easily deployed and managed. It facilitates container scheduling and orchestration.

For application developers, Kubernetes can be regarded as a cluster operating system. Kubernetes provides functions such as service discovery, scaling, load balancing, self-healing, and even leader election, freeing developers from infrastructure-related configurations.

When you use Kubernetes, it is like running a giant number of servers all on the same physical machine, and then running your applications on that single massive platform. Kubernetes enables you to deploy applications always using the same method, regardless of how many servers there are in a cluster.

Figure 1 Running applications in a Kubernetes cluster

Kubernetes Cluster Architecture

A Kubernetes cluster consists of master nodes and worker nodes. Applications are deployed on worker nodes, and you can specify the nodes for deployment.

NOTE:

For CCE clusters, master nodes are managed by CCE. You only need to create worker nodes.

The following figure shows the architecture of a Kubernetes cluster.

Figure 2 Kubernetes cluster architecture

Master node

A master node is the machine where the control plane components run, including the API server, scheduler, controller manager, and etcd.

  • API server: a transit station for components to communicate with each other. It receives external requests and writes data to etcd.
  • Controller manager: carries out cluster-level functions, such as component replication, worker node tracing, and node fault troubleshooting.
  • Scheduler: schedules pods to nodes based on various conditions (such as available resources and node affinity).
  • etcd: provides distributed data storage for cluster configurations.

In a production environment, multiple master nodes are deployed to ensure high cluster availability. For example, you can deploy three master nodes in a CCE cluster.

Worker node

A worker node is a compute node for containerized applications in a cluster. A worker node consists of the following components:

  • kubelet: communicates with the container runtime, interacts with the API server, and manages pods on the node.
  • kube-proxy: serves as an access proxy between application components.
  • Container runtime: functions as an engine such as Docker for downloading images and running containers.

Kubernetes Scalability

Kubernetes makes the Container Runtime Interface (CRI), Container Network Interface (CNI), and Container Storage Interface (CSI) open-sourced. These interfaces maximize Kubernetes scalability and allow Kubernetes to focus on container scheduling.

  • CRI: provides computing resources for a container runtime. It makes differences between container engines irrelevant and interacts with each container engine through a unified interface.
  • CNI: enables Kubernetes to support different networking implementations. For example, the custom CNI add-on of CCE allows your Kubernetes clusters to run in VPCs.
  • CSI: enables Kubernetes to support various classes of storage. For example, CCE can be interconnected with block storage (EVS), file storage (SFS), and object storage (OBS) services.

Basic Objects in Kubernetes

The following figure shows the basic objects in Kubernetes and the relationships between them.

Figure 3 Basic Kubernetes objects
  • Pod

    Pods are the smallest deployable units of compute that you can create and manage in Kubernetes. A pod is a group of one or more containers. Pods have shared storage, unique IP addresses, and specifications for how to run containers.

  • Deployment

    A Deployment is a service-oriented encapsulation of pods. It can contain one or more pods. These pods have the same role, and the system automatically distributes requests to the pods of a Deployment.

  • StatefulSet

    A StatefulSet is used to manage stateful applications. Like a Deployment, a StatefulSet manages a group of pods that are based on an identical container specification. Unlike a Deployment, a StatefulSet maintains a fixed ID for each of their pods. These pods are created based on the same declaration, but they are not interchangeable. Each pod has a permanent ID regardless of how it was scheduled.

  • Job

    A job is used to control batch tasks. Jobs are different from long-term servo tasks (such as Deployments). Jobs are started and terminated at specific times, but long-term servo tasks continue to run until they are specifically terminated. The pods managed by a job will be automatically removed after successfully completing tasks based on user configurations.

  • CronJob

    A CronJob is a time-based job. Similar to the crontab of Linux, it runs a specified job in a specified time range.

  • DaemonSet

    A DaemonSet runs only one pod on each node in a cluster. This works well for certain system-level applications such as log collection and resource monitoring since they must run on each node and need only a few pods. A good example is kube-proxy.

  • Service

    A Service is used for pod access. With a fixed IP address, a Service forwards access traffic to pods and balances load for these pods.

  • Ingress

    Services forward requests at Layer 4 using TCP and UDP. Ingresses can forward requests at Layer 7 using HTTP and HTTPS and make forwarding more targeted by domain names and paths.

  • ConfigMap

    A ConfigMap stores configurations in key-value pairs required by applications. ConfigMaps allow you to decouple environment-specific configurations from container images, so that different environments can have their own unique configurations.

  • Secret

    A secret lets you store and manage sensitive information, such as authentication information, certificates, and private keys. Storing confidential information in a secret is safer and more flexible than putting it verbatim in a pod definition or in a container image.

  • PersistentVolume (PV)

    A PV describes a persistent data storage volume. It defines a directory for persistent storage on a host machine, for example, a mount directory of a network file system (NFS).

  • PersistentVolumeClaim (PVC)

    A PVC in Kubernetes is a request for persistent storage. PVCs free you from creating and releasing underlying storage resources. With PVCs, you only need to specify the storage type and capacity.

Setting Up a Kubernetes Cluster

Kubernetes introduces multiple methods for setting up a Kubernetes cluster, such as minikube and kubeadm.

If you do not want to set up a Kubernetes cluster by yourself, you can purchase one on the CCE console. The following uses clusters purchased on the CCE console as examples.

Kubernetes Objects

Resources in Kubernetes can be described in YAML or JSON format. An object consists of the following parts:

  • typeMeta: metadata of the object type. It specifies the API version and type of the object.
  • objectMeta: metadata of the object, such as the object name and labels.
  • spec: desired status of the object, for example, which image the object uses and how many replicas the object has.
  • status: actual status of the object. It can only be viewed after the object is created. You do not need to specify the status when creating an object.
Figure 4 YAML file

Running Applications on Kubernetes

Delete status from the content in Figure 4 and save it as the nginx-deployment.yaml file, as shown below:

apiVersion: apps/v1
kind: Deployment
metadata:
  name:  nginx
  labels:
    app:  nginx
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3
  template:
    metadata:
      labels:
    app:  nginx
    spec:
      containers:
      - name:  nginx
        image:  nginx:alpine
        resources:
          requests:
            cpu: 100m
            memory: 200Mi
          limits:
            cpu: 100m
            memory: 200Mi
      imagePullSecrets:
      - name: default-secret

Use kubectl to access the cluster and run the following command:

# kubectl create -f nginx-deployment.yaml 
deployment.apps/nginx created

After the command is executed, three pods are created in the Kubernetes cluster. You can run the following command to obtain the Deployment and pods:

# kubectl get deploy
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
nginx   3/3     3            3           9s

# kubectl get pods
NAME                     READY   STATUS    RESTARTS   AGE
nginx-685898579b-qrt4d   1/1     Running   0          15s
nginx-685898579b-t9zd2   1/1     Running   0          15s
nginx-685898579b-w59jn   1/1     Running   0          15s

So far, we have walked you through containers and Docker, Kubernetes cluster setup, and basic Kubernetes concepts, and provided you an example of how to use kubectl. The following sections will go deeper into Kubernetes objects and how they are used and related.

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