Skip to content
Migrate Pure Storage FlashArray Volumes to PKS - List, Snap and Clone vVols used for Kubernetes Persistent Volumes
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tools
.gitignore
29_k8s4vvols.png
README.md
clone-play.yml
fcd_attach_vdisk_to_vm.py
fcd_create_vdisk.py
fcd_create_vdisk_from_snapshot.py
fcd_create_vdisk_snapshot.py
fcd_delete_vdisk.py
fcd_delete_vdisk_snapshot.py
fcd_list_vdisk.py
fcd_list_vdisk_snapshots.py
get_vvol_from_pvc.py
k8s2pks.sh
pure_pks_vvol.py
settings.json
snap_vvol.py

README.md

K8s4vvols

List, Snap and Clone vvols used for Kubernetes Persistent Volumes

Start with PyVmomi

I started here with the great examples written for python and first class disks.

PyVomi Community Examples

Other required packages

We need the kubernetes module and the purestorage module for python.

pip install kubernetes
pip install purestorage

If you are using macosx and it is messing up your python environment you might need to:

pip3 install kubernetes
pip3 install purestorage

It is also required to have Ansible 2.8.x installed.

How to use to import to PKS functions

  1. First add your FlashArray IP and API token in two places.
pure_pks_vvol.py
and
clone-play.yml

Each should have a clearly marked section for you to edit. Also edit the pure_pks_vvol.py file and change this line to match your KUBECONFIG. Failure to do so will result in more failing.

config.load_kube_config(config_file="<Path to KUBECONFIG>")
  1. Run the shell script (or create your own), you must supply the source PVC name or it will fail.

This script will scale down the deployment, in this demo script it is minio-deployment in the PKS cluster named testcluster. Your environment will vary. Please edit the script. Know the risks of messing with deployments and only do this if you are sure you have this right. I would hate for you to take down a Production app because you were playing with my script. Also, If you skip this section and do it anyway. It isn't my fault.

Also we assume you are using PSO. Make the pso-

./k8s2pks.sh <Your PVC Name>

FCD python files

These are for reference, mostly. The ansible playbook and python do not call them directly but might use the "tools" folder these scrips use. Honestly, these are handy to have around.

You can’t perform that action at this time.