Skip to content

StatefulSet

Gregory Nickonov edited this page Mar 4, 2019 · 3 revisions

Quick Start

R.stateful_set :database do
  container do
    image 'postgres:alpine'

    expose_port 5432

    environment do
      add POSTGRES_USER: 'postgres', POSTGRES_PASSWORD: 'secretpassword'
    end

    mount_volume :data, '/var/lib/postgresql/data', sub_path: 'data'
  end

  volume_claim :data do
    access_mode :ReadWriteOnce
    storage_request '8Gi'
    storage_class_name 'ssd'
  end
end

StatefulSet is one of the Pod Template Owners, so all methods, like pod_template and container are available.

StatefulSet

Kubernetes Documentation

Sunstone property Kubernetes property Type
metadata metadata Kubernetes Object Metadata
spec spec StatefulSetSpec

volume_claim

Declares a PersistentVolumeClaim with the specified name and uses supplied block to configure newly declared volume claim:

R.stateful_set :database do
  volume_claim :data do
    # Configure claim here
  end
end

StatefulSetSpec

Kubernetes Documentation

Sunstone property Kubernetes property Type
pod_management_policy podManagementPolicy String
replicas replicas Integer
revision_history_limit revisionHistoryLimit Integer
selector selector LabelSelector
service_name serviceName String
template template PodTemplateSpec
update_strategy updateStrategy StatefulSetUpdateStrategy
volume_claim_templates volumeClaimTemplates Array of PersistentVolumeClaim

StatefulSetUpdateStrategy

Kubernetes Documentation

Sunstone property Kubernetes property Type
type type String
rolling_update rollingUpdate RollingUpdateStatefulSetUpdateStrategy

RollingUpdateStatefulSetUpdateStrategy

Kubernetes Documentation

Sunstone property Kubernetes property Type
partition partition Integer
Clone this wiki locally