StorageCluster
The Portworx cluster configuration is specified by a Kubernetes CRD (CustomResourceDefinition) called StorageCluster. The StorageCluster object acts as the definition of the Portworx Cluster.
The StorageCluster
object provides a Kubernetes native experience. You can manage your Portworx cluster just like any other application running on Kubernetes. That is, if you create or edit the StorageCluster
object, the operator will create or edit the Portworx cluster in the background.
To generate a StorageCluster
spec customized for your environment, point your browser to Portworx Central, and click "Install and Run" to start the Portworx spec generator. Then, the wizard will walk you through all the necessary steps to create a StorageCluster
spec customized for your environment.
Note that using the Portworx spec generator is the recommended way of generating a StorageCluster
spec. However, if you want to generate the StorageCluster
spec manually, you can refer to the StorageCluster Examples and StorageCluster Schema sections.
StorageCluster Examples
This section provides a few examples of common Portworx configurations you can use for manually configuring your Portworx cluster. Update the default values in these files to match your environment.
-
Portworx with internal KVDB, configured to use all unused devices on the system.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
kvdb:
internal: true
storage:
useAll: true -
Portworx with external ETCD and Stork as default scheduler.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
kvdb:
endpoints:
- etcd:http://etcd-1.net:2379
- etcd:http://etcd-2.net:2379
- etcd:http://etcd-3.net:2379
authSecret: px-kvdb-auth
stork:
enabled: true
args:
health-monitor-interval: "100"
webhook-controller: "true" -
Portworx with Security enabled.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
security:
enabled: true -
Portworx with Security enabled, guest access disabled, a custom self signed issuer/secret location, and five day token lifetime.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
security:
enabled: true
auth:
guestAccess: 'Disabled'
selfSigned:
issuer: 'openstorage.io'
sharedSecret: 'px-shared-secret'
tokenLifetime: '5d' -
Portworx with update and delete strategies, and placement rules.
noteFrom Kubernetes version 1.24 and newer, the label key
node-role.kubernetes.io/master
is replaced bynode-role.kubernetes.io/control-plane
.apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 20%
deleteStrategy:
type: UninstallAndWipe
placement:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: px/enabled
operator: NotIn
values:
- "false"
- key: node-role.kubernetes.io/control-plane
operator: DoesNotExist
- key: node-role.kubernetes.io/worker
operator: Exists
tolerations:
- key: infra/node
operator: Equal
value: "true"
effect: NoExecute -
Portworx with custom image registry, network interfaces, and miscellaneous options.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
imagePullPolicy: Always
imagePullSecret: regsecret
customImageRegistry: docker.private.io/repo
network:
dataInterface: eth1
mgmtInterface: eth2
secretsProvider: vault
runtimeOptions:
num_io_threads: "10"
env:
- name: VAULT_ADDRESS
value: "http://10.0.0.1:8200" -
Portworx with node specific overrides. Use different devices or no devices on different set of nodes.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0
storage:
devices:
- /dev/sda
- /dev/sdb
nodes:
- selector:
labelSelector:
matchLabels:
<custom-key>:"<custom-value>"
storage:
devices:
- /dev/nvme1
- /dev/nvme2
- selector:
labelSelector:
matchLabels:
<custom-key>:"<custom-value>"
storage:
devices: []Replace
<custom-key>:<custom-value1>
with the node label that you have added for the node in your cluster. For example, if you have labeled your node aspx/storage: "nvme"
to specify that the node uses NVME drives, you may use this key-value pair, wherecustom-key
ispx/storage
andcustom-value
isnvme
. -
Portworx with a cluster domain defined.
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
annotations:
portworx.io/misc-args: "-cluster_domain example-cluster-domain-name” -
Portworx with an option to use HTTPS proxy to enable telemetry and share cluster diagnostics and callhome data to Pure1 cloud:
apiVersion: core.libopenstorage.org/v1
kind: StorageCluster
metadata:
name: portworx
namespace: <px-namespace>
spec:
image: portworx/oci-monitor:3.0.0
env:
- name: PX_HTTP_PROXY
value: "http://<IP:port>"
- name: PX_HTTPS_PROXY
value: "http://<IP:port>"
You can use http://user:password@<IP:port>;
if your proxy requires authentication.
StorageCluster Schema
This section explains the fields used to configure the StorageCluster
object.
Field | Description | Type | Default |
---|---|---|---|
spec. image | Specifies the Portworx monitor image. | string | None |
spec. imagePullPolicy | Specifies the image pull policy for all the images deployed by the operator. It can take one of the following values: Always or IfNotPresent | string | Always |
spec. imagePullSecret | If Portworx pulls images from a secure repository, you can use this field to pass it the name of the secret. Note that the secret should be in the same namespace as the StorageCluster object. | string | None |
spec. customImageRegistry | The custom container registry server Portworx uses to fetch the Docker images. You may include the repository as well. | string | None |
spec. secretsProvider | The name of the secrets provider Portworx uses to store your credentials. To use features like cloud snapshots or volume encryption, you must configure a secret store provider. Refer to the Secret store management page for more details. | string | None |
spec. runtimeOptions | A collection of key-value pairs that overwrites the runtime options. | map[string]string | None |
spec. security | An object for specifying PX-Security configurations. Refer to the Operator Security page for more details. | object | None |
spec. featureGates | A collection of key-value pairs specifying which Portworx features should be enabled or disabled. 1 | map[string]string | None |
spec. env[] | A list of Kubernetes like environment variables. Similar to how environment variables are provided in Kubernetes, you can directly provide values to Portworx or import them from a source like a Secret , ConfigMap , etc. | []object | None |
spec. metadata. annotations | A map of components and custom annotations. 2 | map[string]map[string]string | None |
spec. metadata. labels | A map of components and custom labels. 3 | map[string]map[string]string | None |
spec. resources. requests. cpu | Specifies the cpu that the Portworx container requests; for example: "4000m" | string | None |
spec. resources. requests. memory | Specifies the memory that the Portworx container requests; for example: "4Gi" | string | None |
KVDB configuration
This section explains the fields used to configure Portworx with a KVDB. Note that, if you don't specify the endpoints, the operator starts Portworx with the internal KVDB.
Field | Description | Type | Default |
---|---|---|---|
spec. kvdb. internal | Specifies if Portworx starts with the internal KVDB. | boolean | true |
spec. kvdb.endpoints[] | A list of endpoints for your external key-value database like ETCD. This field takes precedence over the spec.kvdb.internal field. That is, if you specify the endpoints, Portworx ignores the spec.kvdb.internal field and it uses the external KVDB. | []string | None |
spec. kvdb. authSecret | Indicates the name of the secret Portworx uses to authenticate against your KVDB. The secret must be placed in the same namespace as the StorageCluster object. The secret should provide the following information: - username (optional) - password (optional) - kvdb-ca.crt (the CA certificate) - kvdb.key (certificate key) - kvdb.crt (etcd certificate) - acl-token (optional) For example, create a directory called etcd-secrets, copy the files into it and create a secret with kubectl -n kube-system create secret generic px-kvdb-auth --from-file=etcd-secrets/ | string | None |
Storage configuration
This section provides details about the fields used to configure the storage for your Portworx cluster. If you don't specify a device, the operator sets the spec.storage.useAll
field to true
.
Field | Description | Type | Default |
---|---|---|---|
spec. storage. useAll | If set to true , Portworx uses all available, unformatted, and unpartitioned devices. 4 | boolean | true |
spec. storage. useAllWithPartitions | If set to true , Portworx uses all the available and unformatted devices. 4 | boolean | false |
spec. storage. forceUseDisks | If set to true , Portworx uses a device even if there's a file system on it. Note that Portworx may wipe the drive before using it. | boolean | false |
spec. storage. devices[] | Specifies the list of devices Portworx should use. | []string | None |
spec. storage. cacheDevices[] | Specifies the list of cache devices Portworx should use. | []string | None |
spec. storage. journalDevice | Specifies the device Portworx uses for journaling. | string | None |
spec. storage. systemMetadataDevice | Indicates the device Portworx uses to store metadata. For better performance, specify a system metadata device when using Portworx with the internal KVDB. | string | None |
spec. storage. kvdbDevice | Specifies the device Portworx uses to store internal KVDB data. | string | None |