Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

2000 bits after using job in Kubernetes to calculate pi

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Using job in Kubernetes, we can easily perform some time-consuming operations.

Create a new job.ymal file:

A Kubernetes job is defined, named pi, type job, container name pi, image perl, and the per command executed is print bpi (2000):

The complete contents of this ymal file:

ApiVersion: batch/v1

Kind: Job

Metadata:

Name: pi

Spec:

Template:

Metadata:

Name: pi

Spec:

Containers:

Name: pi

Image: perl

Command: ["perl", "- Mbignum=bpi", "- wle", "print bpi (2000)"]

RestartPolicy: Never

Import the yaml file using the command kubectl create-f to create a new job:

Later, you can see the new job in Kubernetes's dashboard:

The pod status of job is Waiting ContainerCreating:

Later, its status changed from Running to Terminated:Completed, which took a total of 14 minutes.

In the pod event log, you can see that most of the time is spent downloading the perl image:

Click on dashboard's logs button to see the 2000-bit pi calculation:

For more original Jerry articles, please follow the official account "Wang Zixi":

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report