You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Understand state management in Kubernetes
6
-
ms.date: 01/04/2024
6
+
ms.date: 03/23/2026
7
7
author: davidsmatlak
8
8
ms.author: davidsmatlak
9
9
ms.topic: unit
@@ -20,12 +20,12 @@ quiz:
20
20
questions:
21
21
- content: "What's the persistent state of an application?"
22
22
choices:
23
-
- content: "It's the type of state that continues to exist even after the application has been closed."
23
+
- content: "It's the type of state that continues to exist even after the application was closed."
24
24
isCorrect: true
25
25
explanation: "Although state itself involves all the contents of an application stored in memory, the persistent state is the one that needs to be stored persistently across the lifecycle of the application."
26
-
- content: "It's the state that's stored in memory or locally on the container."
26
+
- content: "It's the state stored in memory or locally on the container."
27
27
isCorrect: false
28
-
explanation: "This is the ephemeral state. It's stored only in local memory or in the local container's file system and destroyed after the application or container is closed."
28
+
explanation: "This state is the ephemeral state. It's stored only in local memory or in the local container's file system and destroyed after the application or container is closed."
29
29
- content: "It's all the disks and volumes that compose the application."
30
30
isCorrect: false
31
31
explanation: "Disks and volumes make a state persistent, but they store only the state."
@@ -47,8 +47,7 @@ quiz:
47
47
explanation: "Although it's possible to store state in Kubernetes, the complexity of maintaining that for a highly available and scalable application doesn't pay off."
48
48
- content: "Remove any possible state and use only ephemeral storage."
49
49
isCorrect: false
50
-
explanation: "Although this is the easiest solution, it's nearly impossible to hold a large system together without any state management."
50
+
explanation: "Although this state is the easiest solution, it's nearly impossible to hold a large system together without any state management."
51
51
- content: "Delegate the state management to external specialized solutions."
52
52
isCorrect: true
53
53
explanation: "To efficiently solve all scalability and availability problems, the best option is to externalize the state to specialized applications such as Azure Cosmos DB."
Copy file name to clipboardExpand all lines: learn-pr/azure/aks-manage-application-state/includes/1-introduction.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
Imagine you work for a freight company that uses ships to transport goods across the world. The operations department uses a small system that tracks where all the company's ships are docked. Due to staff increases, your company has decided to move this system to Kubernetes.
1
+
Imagine you work for a freight company that uses ships to transport goods across the world. The operations department uses a small system that tracks where each ship is docked. Due to staff increases, your company decided to move this system to Kubernetes.
2
2
3
-
The system's application uses Azure Cosmos DB as a database, and it's built through a separated back end. You've been tasked with determining how to manage your database access in this distributed environment and how to deploy a new database to support this critical application.
3
+
The system's application uses Azure Cosmos DB as a databasebuilt through a separate back end. You were assigned to determine how to manage your database access in this distributed environment and how to deploy a new database to support this critical application.
Copy file name to clipboardExpand all lines: learn-pr/azure/aks-manage-application-state/includes/2-understand-state-management.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
-
When talking about applications in general, you might often hear about the *application state*. In this unit, we review the definition of state and the different types of states so you can better prepare your application for handling them.
1
+
When talking about applications in general, you might often hear about the _application state_. In this unit, we review the definition of state and the different types of states so you can better prepare your application to handle various states.
2
2
3
3
## State
4
4
5
-
The state of the application is everything that's stored in memory by the time the application is running. The state can involve various things, but we mostly focus on the user data.
5
+
The state of the application is everything stored in memory by the time the application is running. The state can involve various things, but we mostly focus on the user data.
6
6
7
-
To give an example of application state, imagine you have a music player opened. This application has a state. It knows who you are, what you like to hear, and what music you've downloaded. All this information is part of the application state.
7
+
To give an example of application state, imagine you have a music player opened. This application has a state. It knows who you are, what you like to hear, and which music you downloaded. All this information is part of the application state.
8
8
9
9
The in-memory state is the information that the application doesn't need to look for anywhere else. The disk state contains the information that the application doesn't have at hand, so it needs to retrieve that from another data source.
10
10
11
11
### Types of states
12
12
13
-
There are two types of application states. The first type is the *ephemeral state*, which isn't persistent and vanishes as soon as the application is closed.
13
+
There are two types of application states. The first type is the _ephemeral state_, which isn't persistent and vanishes as soon as the application is closed.
14
14
15
-
Containers have an ephemeral state. All of the data stored within them is instantly lost when the container is deleted. Some applications can work with that alone, because they can regenerate the state from other sources and don't need the state to be stored locally. Those applications are called *:::no-loc text="stateless"::: applications*.
15
+
Containers have an ephemeral state. All of the data stored within them is instantly lost when the container is deleted. Some applications can work with that alone, because they can regenerate the state from other sources and don't need the state to be stored locally. Those applications are called _:::no-loc text="stateless"::: applications_.
16
16
17
-
All the remaining state that isn't ephemeral is called *persistent state*. Persistent state continues to exist after the lifecycle of a container. Most container technologies that we use have the concept of *volume*, an in-disk location where the state exists. Even if you remove the container and turn it back on, the state remains stored in a safe location and can be used again.
17
+
The remaining state that isn't ephemeral is called _persistent state_. Persistent state continues to exist after the lifecycle of a container. Most container technologies that we use have the concept of _volume_, an in-disk location where the state exists. If you remove the container and turn it back on, the state remains stored in a safe location and can be used again.
18
18
19
-
Applications that rely on an external state to be retrieved are called *:::no-loc text="stateful"::: applications*.
19
+
Applications that rely on an external state to be retrieved are called _:::no-loc text="stateful"::: applications_.
20
20
21
21
## States and Kubernetes
22
22
@@ -26,14 +26,14 @@ For most stateless applications, a simple deployment workload with a pod would b
26
26
27
27
Dealing with stateful applications is the opposite. In these cases, you need to consider the application and its state, where the state is stored, and how you can store the state securely and reliably.
28
28
29
-
This is why Kubernetes also has the concept of *:::no-loc text="PersistentVolumes":::* (PVs) and *:::no-loc text="PersistentVolumeClaims":::* (PVCs).
29
+
This is why Kubernetes also has the concept of _:::no-loc text="PersistentVolumes":::_ (PV) and _:::no-loc text="PersistentVolumeClaims":::_ (PVC).
30
30
31
31
> [!TIP]
32
32
> This module doesn't discuss storage concepts further, but you can refer to the Azure Kubernetes Service resources in the summary to learn more.
33
33
34
-
`PersistentVolumes` are disks that are allocated in nodes to store states from a pod's container. Because Kubernetes is best for distributed apps, all created volumes lie in a pool of *available volumes*. Containers then claim that space for themselves. You can use `PersistentVolumeClaims` to bind a `PersistentVolume` with a pod and use its space to store the needed data.
34
+
`PersistentVolumes` are disks that are allocated in nodes to store states from a pod's container. Because Kubernetes is best for distributed apps, all created volumes lie in a pool of _available volumes_. Containers then claim that space for themselves. You can use `PersistentVolumeClaims` to bind a `PersistentVolume` with a pod and use its space to store the needed data.
35
35
36
-
All database providers are stateful applications. If you're deploying a database provider in your cluster, you need a PV and a PVC to store the database data in a safe spot and allow the provider to retrieve that data even if its containers were deleted.
36
+
All database providers are stateful applications. If you're deploying a database provider in your cluster, you need a PV and a PVC to store the database data and allow the provider to retrieve that data even if its containers were deleted.
37
37
38
38
## Best practices for state handling
39
39
@@ -43,15 +43,15 @@ You design any efficient application with the goal of making it highly available
43
43
44
44
### Highly available state
45
45
46
-
To be highly available, an application must be online at all times. This is done through zone and region replication. Kubernetes is zone aware in most of its workloads. That means you can have several instances of an application that are deployed in different zones. However, disks aren't zone aware.
46
+
To be highly available, an application must always be online. This is done through zone and region replication. Kubernetes is zone aware in most of its workloads. That means you can have several instances of an application that are deployed in different zones. However, disks aren't zone aware.
47
47
48
-
When you deploy a new `PersistentVolume` object on Kubernetes, it's bound to a disk on a node. That disk is also bound to a particular zone in a particular region. Using zone or region replication with PVs is complex and requires a lot of maintenance, both to replicate and to synchronize data.
48
+
When you deploy a new `PersistentVolume` object on Kubernetes, it's bound to a disk on a node. That disk is also bound to a particular zone in a particular region. Using zone or region replication with PVs is complex and requires much maintenance, both to replicate and to synchronize data.
49
49
50
50
### Highly scalable state
51
51
52
52
To be highly scalable, an application should grow its throughput together with the number of users who are connected to it. This is complicated in state management because any external state is essentially a disk, and a disk has a limited input and output rate. Throughput management helps solve this problem.
53
53
54
-
Database solutions came up with the idea of *:::no-loc text="ReplicaSets":::*, which replicate the whole database into multiple instances. The replication increases the number of disks *and* the I/O for the state.
54
+
Database solutions came up with the idea of _:::no-loc text="ReplicaSets":::_ which replicate the whole database into multiple instances. The replication increases the number of disks _and_ the I/O for the state.
55
55
56
56
On every database change, the state needs to be synchronized so that all disks contain the same data. This synchronization is also complex.
0 commit comments