Skip to content

Commit b38ed1b

Browse files
committed
simplify the lifecycle of a pod
Signed-off-by: Wang Xu <[email protected]>
1 parent 3334fbb commit b38ed1b

File tree

4 files changed

+41
-33
lines changed

4 files changed

+41
-33
lines changed

Diff for: figures/lifecycle.png

22.9 KB
Loading

Diff for: get_started/lifecycle.md

+39-33
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
# Lifecycle
22

3-
![](https://trello-attachments.s3.amazonaws.com/5562ba47387906ddef327e00/704x249/e4b1ec0168197c13e838bd5b405b3f28/pod.png)
3+
![](../figures/lifecycle.png)
44

5-
In Hyper, a Pod has two states:
5+
> Since v0.8, HyperContainer simplified the model (and the state machine), we won't maintain Pod and VM lifecycle independently any more.
66
7-
- `Created`: a Pod is defined, its storage has been allocated, and the Docker images have been downloaded
8-
- `Running`: a Pod (with its containers) is launched in a VM instance
7+
In HyperContainer, a Pod is encapsulated in a VM. A Pod can be launched either explicitly:
98

10-
11-
A Pod can be launched either explicitly:
12-
13-
[root@user ~:]# hyperctl run -p podfile.json
9+
➜ sudo ./hyperctl run -p podfile.json
1410

1511
Or, implicitly:
1612

17-
[root@user ~:]# hyperctl run -t ubuntu
18-
19-
In both cases, Pods and VMs are indivisible. Hyper will automatically provision a new VM instance to host the Pod, and the Pod will be `Running`.
20-
21-
However, you can also create a Pod, but without an underlying VM. In such case, the pod stays in `Created` state.
22-
23-
[root@user ~:]# hyperctl create -p podfile.json
24-
25-
There are two options to start the pod:
26-
27-
[root@user ~:]# hyperctl start pod_id
28-
29-
The `START` command will trigger a VM provisioned, and allocate the new VM to the Pod.
30-
31-
When you `STOP` a Pod, the underlying VM instance will be terminated:
32-
33-
[root@user ~:]# hyperctl stop pod_id
34-
35-
When stopped, the Pod will return to the `Created` state.
36-
37-
To permantly destroy a Pod, you need to `RM` it:
38-
39-
[root@user ~:]# hyperctl rm pod_id
40-
41-
Hyper will (stop if neccessary, then) remove the Pod definition and its storage.
13+
➜ sudo ./hyperctl run -d nginx
14+
POD id is nginx-8530075287
15+
16+
In both cases, Pods and VMs are indivisible. Hyper will automatically provision a new VM instance to host the Pod, and the Pod will be `Running`. There may be zero, one, or more containers in a Pod. And you may create, start, stop, and remove containers in/from a Pod.
17+
18+
➜ sudo ./hyperctl create -c -d nginx-8530075287 busybox
19+
Container ID is a8fd34f686e6587979936df880b9e9144fefd895d19560493d2028aa82c47f0c
20+
➜ sudo ./hyperctl list container
21+
Container ID Name POD ID Status
22+
6e8c08420389a165682586380fa35432f5922287b9aec34059ed1ff68b3f1623 nginx-8530075287 nginx-8530075287 running
23+
a8fd34f686e6587979936df880b9e9144fefd895d19560493d2028aa82c47f0c busybox-2602968228 nginx-8530075287 pending
24+
➜ sudo ./hyperctl start -c busybox-2602968228
25+
Successfully started container busybox-2602968228
26+
➜ sudo ./hyperctl list container
27+
Container ID Name POD ID Status
28+
a8fd34f686e6587979936df880b9e9144fefd895d19560493d2028aa82c47f0c busybox-2602968228 nginx-8530075287 running
29+
6e8c08420389a165682586380fa35432f5922287b9aec34059ed1ff68b3f1623 nginx-8530075287 nginx-8530075287 running
30+
➜ sudo ./hyperctl stop -c busybox-2602968228 nginx-8530075287
31+
➜ sudo ./hyperctl list container
32+
Container ID Name POD ID Status
33+
6e8c08420389a165682586380fa35432f5922287b9aec34059ed1ff68b3f1623 nginx-8530075287 nginx-8530075287 succeeded
34+
a8fd34f686e6587979936df880b9e9144fefd895d19560493d2028aa82c47f0c busybox-2602968228 nginx-8530075287 succeeded
35+
➜ sudo ./hyperctl rm -c busybox-2602968228 nginx-8530075287
36+
container busybox-2602968228 is successfully deleted!
37+
container nginx-8530075287 is successfully deleted!
38+
➜ sudo ./hyperctl list container
39+
Container ID Name POD ID Status
40+
➜ sudo ./hyperctl list
41+
POD ID POD Name VM name Status
42+
nginx-8530075287 nginx-8530075287 vm-pqEnBvQVdS running
43+
44+
And you could stop or remove the Pod.
45+
46+
➜ sudo ./hyperctl rm nginx-8530075287
47+
Pod(nginx-8530075287) is successfully deleted!

Diff for: release_notes/latest.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
In version 0.8, Hyperd and RunV was refactored, and introduced several significant updates, such as support the Kubernetes Container Runtime Interface (CRI) semantics, and support OCI images spec. Here are some highlight features of the release.
44

55
- Refactor: Move all the Pod level logic to hyperd, and runV only maintains the sandbox and containers.
6+
- Refactor: Simplified the model and state machine -- one Pod is one VM.
67
- Refactor: Allow add/remove containers to/from a Pod/sandbox.
78
- Refactor: Don't stop Sandbox without an explicit stop command even if the last container is stopped. This is compatible to the k8s CRI semantics.
89
- Feature: Support OCI Image Spec.

Diff for: release_notes/v0.8.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
In version 0.8, Hyperd and RunV was refactored, and introduced several significant updates, such as support the Kubernetes Container Runtime Interface (CRI) semantics, and support OCI images spec. Here are some highlight features of the release.
44

55
- Refactor: Move all the Pod level logic to hyperd, and runV only maintains the sandbox and containers.
6+
- Refactor: Simplified the model and state machine -- one Pod is one VM.
67
- Refactor: Allow add/remove containers to/from a Pod/sandbox.
78
- Refactor: Don't stop Sandbox without an explicit stop command even if the last container is stopped. This is compatible to the k8s CRI semantics.
89
- Feature: Support OCI Image Spec.

0 commit comments

Comments
 (0)