tencent cloud

Tencent Kubernetes Engine

Release Notes and Announcements
Release Notes
Announcements
Release Notes
Product Introduction
Overview
Strengths
Architecture
Scenarios
Features
Concepts
Native Kubernetes Terms
Common High-Risk Operations
Regions and Availability Zones
Service Regions and Service Providers
Open Source Components
Purchase Guide
Purchase Instructions
Purchase a TKE General Cluster
Purchasing Native Nodes
Purchasing a Super Node
Getting Started
Beginner’s Guide
Quickly Creating a Standard Cluster
Examples
Container Application Deployment Check List
Cluster Configuration
General Cluster Overview
Cluster Management
Network Management
Storage Management
Node Management
GPU Resource Management
Remote Terminals
Application Configuration
Workload Management
Service and Configuration Management
Component and Application Management
Auto Scaling
Container Login Methods
Observability Configuration
Ops Observability
Cost Insights and Optimization
Scheduler Configuration
Scheduling Component Overview
Resource Utilization Optimization Scheduling
Business Priority Assurance Scheduling
QoS Awareness Scheduling
Security and Stability
TKE Security Group Settings
Identity Authentication and Authorization
Application Security
Multi-cluster Management
Planned Upgrade
Backup Center
Cloud Native Service Guide
Cloud Service for etcd
TMP
TKE Serverless Cluster Guide
TKE Registered Cluster Guide
Use Cases
Cluster
Serverless Cluster
Scheduling
Security
Service Deployment
Network
Release
Logs
Monitoring
OPS
Terraform
DevOps
Auto Scaling
Containerization
Microservice
Cost Management
Hybrid Cloud
AI
Troubleshooting
Disk Full
High Workload
Memory Fragmentation
Cluster DNS Troubleshooting
Cluster kube-proxy Troubleshooting
Cluster API Server Inaccessibility Troubleshooting
Service and Ingress Inaccessibility Troubleshooting
Common Service & Ingress Errors and Solutions
Engel Ingres appears in Connechtin Reverside
CLB Ingress Creation Error
Troubleshooting for Pod Network Inaccessibility
Pod Status Exception and Handling
Authorizing Tencent Cloud OPS Team for Troubleshooting
CLB Loopback
API Documentation
History
Introduction
API Category
Making API Requests
Elastic Cluster APIs
Resource Reserved Coupon APIs
Cluster APIs
Third-party Node APIs
Relevant APIs for Addon
Network APIs
Node APIs
Node Pool APIs
TKE Edge Cluster APIs
Cloud Native Monitoring APIs
Scaling group APIs
Super Node APIs
Other APIs
Data Types
Error Codes
TKE API 2022-05-01
FAQs
TKE General Cluster
TKE Serverless Cluster
About OPS
Hidden Danger Handling
About Services
Image Repositories
About Remote Terminals
Event FAQs
Resource Management
Service Agreement
TKE Service Level Agreement
TKE Serverless Service Level Agreement
Contact Us
Glossary

Job Management

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2024-12-19 22:09:58

Overview

A Job creates one or more Pods and ensures that these pods run according to the specified rules until a specified number of them successfully terminate. Jobs can be used in many scenarios, such as batch computing and data analysis. You can specify the number of repeated runs, the level of parallelism and the restart policy as needed. A Job will keep existing Pods and not create new Pods after it is complete. You can view the logs of completed Pods in "Logs". Deleting a Job will clean up the Pods it created as well as the logs of those Pods.

Managing Jobs in the Console

Creating a Job

1. Log in to the TKE console.
2. In the left sidebar, click Cluster to go to the cluster management page.
3. Click the ID of the cluster where Job needs to be created to enter the cluster management page.
4. Select Workload > Job to go to the Job information page, as shown below:


5. Click Create to go to Create Workload page, as shown below:

.
6. Set the Job parameters based on your actual needs. The key parameters are as follows:
Workload Name: custom.
Label: a key-value pair, which is used for classified management of resources.
Namespace: select a namespace based on your requirements.
Type: select Job (One-time Task).
Job Settings: set one or more containers for a Pod of the Job as needed.
Repeat Times: set the times of repeated executions of Pods under this Job.
Concurrent Pods: set the number of parallel Pods in this Job.
Restart Policy: set the restart policy applied when containers under the Pod abnormally exit.
Never: do not restart the container until all the containers under the Pod exit.
OnFailure: the Pod continues to run while the container will be restarted.
Volume (optional): provides storage for the container. It can be a temp path, CVM path, CBS volume, file storage NFS, configuration file and PVC, and it must be mounted to the specified path of the container.
Containers in the Pod: set one or more containers for a Pod of the Job as needs.
Name: custom.
Image: select as needed.
Image Tag: enter the tag based on your actual needs.
CPU/memory limits: set the CPU and memory limit according to Kubernetes' resource limits to improve the robustness of the business.
GPU Resource: you can configure the least GPU resource used by the workload.
Advanced Settings: you can set the parameters such as Working Directory, Running Command, Running Parameter, Container Health Check, and Privileged Container.
Image Access Credential: a container image is private by default. You need to select the image access credential for the TCR instance when creating a workload.
Node Scheduling Policy: the Pod can be scheduled to the node of the Label that meets the expectation according to the scheduling rules.
7. Click Create Workload to complete the process.

Viewing Job Status

1. Log in to the TKE console.
2. In the left sidebar, click Cluster to go to the cluster management page.
3. Click the ID of the cluster for which you want to view the Job status to enter the cluster management page.
4. Select Workload > Job to go to the Job information page, as shown below:
Job


5. To view the Job's details, click its name.

Deleting a Job

A Job will keep existing Pods and not create new Pods after it is complete. You can view the logs of completed Pods in "Logs". Deleting a Job will clean up the Pods it created as well as the logs of those Pods.

Managing Jobs via Kubectl

YAML sample

apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
completions: 2
parallelism: 2
template:
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
backoffLimit: 4
kind: identifies the Job resource type.
metadata: the basic information such as Job name and label.
metadata.annotations: the additional description of the Job. You can set additional enhancements to TKE through this parameter.
spec.completions: the times of repeated executions of Pods under this Job.
spec.parallelism: the number of parallel Pods in this Job.
spec.template: the detailed template configuration for Pod of the Job.

Creating a Job

1. See the YAML sample to prepare the Job YAML file.
2. Install kubectl and connect to a cluster. For detailed operations, see Connecting to a Cluster.
3. Create the Job YAML file.
kubectl create -f Job YAML filename
For example, to create a Job YAML file named pi.yaml, run the following command:
kubectl create -f pi.yaml
4. Run the following command to check whether the Job is successfully created.
kubectl get job
If a message similar to the following is returned, the creation is successful.
NAME DESIRED SUCCESSFUL AGE
job 1 0 1m

Deleting a Job

Run the following command to delete a Job.
kubectl delete job [NAME]


Ajuda e Suporte

Esta página foi útil?

comentários