Skip to content

Instantly share code, notes, and snippets.

@clemenko
Last active April 4, 2025 13:13
Show Gist options
  • Save clemenko/9f7050cceb576e06dd5305cc92ce6874 to your computer and use it in GitHub Desktop.
Save clemenko/9f7050cceb576e06dd5305cc92ce6874 to your computer and use it in GitHub Desktop.

portworx flasharray setup

Can your CSI work with hardware? Portworx CSI can!

Notes from https://docs.portworx.com/portworx-enterprise/platform/kubernetes/flasharray/install/install-flasharray/install-flasharray-cd-da

Maually create PVCs for testing : https://docs.portworx.com/portworx-enterprise/platform/kubernetes/flasharray/operations/storage-operations/create-pvcs/pure-flasharray

Run on all nodes

yum install -y device-mapper-multipath libstoragemgmt-udev libstoragemgmt nfs-utils cryptsetup iscsi-initiator-utils kpartx; systemctl enable --now iscsid

sed -i '/CAPACITY_DATA_HAS_CHANGED/s/#ACTION/ACTION/' /usr/lib/udev/rules.d/90-scsi-ua.rules
systemctl restart systemd-udevd.service

cat << EOF > /etc/multipath.conf
defaults {
	user_friendly_names no
	enable_foreign "^$"
        polling_interval    10
}

devices {
    device {
        vendor                      "NVME"
        product                     "Pure Storage FlashArray"
        path_selector               "queue-length 0"
        path_grouping_policy        group_by_prio
        prio                        ana
        failback                    immediate
        fast_io_fail_tmo            10
        user_friendly_names         no
        no_path_retry               0
        features                    0
        dev_loss_tmo                60
        find_multipaths             yes
    }
    device {
        vendor                   "PURE"
        product                  "FlashArray"
        path_selector            "service-time 0"
        hardware_handler         "1 alua"
        path_grouping_policy     group_by_prio
        prio                     alua
        failback                 immediate
        path_checker             tur
        fast_io_fail_tmo         10
        user_friendly_names      no
        no_path_retry            0
        features                 0
        dev_loss_tmo             600
        find_multipaths          yes
    }
}

blacklist_exceptions {
        property "(SCSI_IDENT_|ID_WWN)"
}

blacklist {
      devnode "^pxd[0-9]*"
      devnode "^pxd*"
      device {
        vendor "VMware"
        product "Virtual disk"
      }
}
EOF

systemctl restart multipathd.service && udevadm control --reload-rules && udevadm trigger

on the server node

curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE=server sh - 
mkdir -p /etc/rancher/rke2/ && echo "token: bootstrapAllTheThings" > /etc/rancher/rke2/config.yaml
systemctl enable --now rke2-server.service

ln -s $(find /var/lib/rancher/rke2/data/ -name kubectl) /usr/local/bin/kubectl

echo "export KUBECONFIG=/etc/rancher/rke2/rke2.yaml PATH=$PATH:/usr/local/bin/:/var/lib/rancher/rke2/bin/" >> ~/.bashrc
source ~/.bashrc

kubectl get node

on the worker nodes

curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE=agent sh -
export RANCHER1_IP=192.168.1.181 # change to the server IP
mkdir -p /etc/rancher/rke2/ 
cat << EOF >> /etc/rancher/rke2/config.yaml
server: https://$RANCHER1_IP:9345
token: bootstrapAllTheThings
EOF
systemctl enable --now rke2-agent.service

install portworx

kubectl create ns portworx

cat << EOF > pure.json 
{
    "FlashArrays": [
        {
            "MgmtEndPoint": "192.168.1.11",
            "APIToken": "3d84e613-c905-649a-2b7a-0bc8def997e9"
        }
    ]
}
EOF

kubectl create secret generic px-pure-secret -n portworx --from-file=pure.json=pure.json

# operator
kubectl apply -f 'https://install.portworx.com/3.2?comp=pxoperator&kbver=1.31.0&ns=portworx'

# spec
cat << EOF | kubectl apply -n portworx  -f -
kind: StorageCluster
apiVersion: core.libopenstorage.org/v1
metadata:
  name: px-cluster
  namespace: portworx
  annotations:
    portworx.io/misc-args: "--oem px-csi"
spec:
  image: portworx/oci-monitor:25.2.0
  imagePullPolicy: IfNotPresent
  kvdb:
    internal: true
  cloudStorage:
    kvdbDeviceSpec: size=32
  stork:
    enabled: false
  csi:
    enabled: true
  monitoring:
    telemetry:
      enabled: false
    prometheus:
      enabled: false
      exportMetrics: false
  env:
  - name: PURE_FLASHARRAY_SAN_TYPE
    value: "ISCSI"
EOF

cat << EOF | kubectl apply -f -
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: sc-portworx-fa-direct-access
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: pxd.portworx.com
parameters:
  backend: "pure_block"
allowVolumeExpansion: true
EOF

sample app install

kubectl apply -f https://raw.githubusercontent.com/clemenko/k8s_yaml/refs/heads/master/flask_simple_nginx.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment