Skip to content
gqlxj1987's Blog
Go back

Statefulness on K8s

Edit page

原文链接

This concept is vastly different than the idea of containers being fast and lightweight and easy to deploy anywhere needed at a moments notice. It’s for this reason that persistent state was purposefully left out of container specs, which opted instead for storage plugins; shifting the responsibility of managing persistent state to another party(container不带storage,而以plugins的方式来进行补充)

There are two key features of an application that require persistent state:

Kubernetes Persistent Volumesand Persistent Volume Claimsprovide a way to abstract the details of how storage is provisioned from how it is consumed.

The .spec.storageClassName can be used to classify the PV as a certain class of storage, which can be leveraged by PVCs to specify a specific class of storage to claim.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mypvc
spec:
  storageClassName: mysc
  accessModes:
    — ReadWriteOnce
  resources:
    requests:
      storage: 8Gi

Edit page
Share this post on:

Previous Post
Knative Eventing
Next Post
The Dataflow Model