Skip to content

Instantly share code, notes, and snippets.

View j-griffith's full-sized avatar

John Griffith j-griffith

  • Bozeman, Montana
View GitHub Profile
cat << EOF | kubectl create -f -
apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
name: rbd
namespace: rook-ceph
spec:
failureDomain: host
replicated:
size: 3
# Run this script to setup keys and create SC: https://gist.github.com/j-griffith/002c040231859678744e35636e876928
key=$(pod=$(kubectl get pod -n rook-ceph-system -l app=rook-ceph-operator -o jsonpath="{.items[0].metadata.name}"); kubectl exec -ti -n rook-ceph-system ${pod} -- bash -c "ceph auth get-key client.admin -c /var/lib/rook/rook-ceph/rook-ceph.config | base64")
cat <<EOF | kubectl create -f -
apiVersion: v1
kind: Secret
metadata:
name: csi-rbd-secret
namespace: default
data:
doublehaul ➜ ~ kubectl get po --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
cdi cdi-apiserver-7ff95b4b-48h6m 1/1 Terminating 0 39m
cdi cdi-apiserver-7ff95b4b-l8gkb 1/1 Running 0 11m
cdi cdi-deployment-68bd99b575-65wch 1/1 Running 0 39m
cdi cdi-operator-7bc764dbb8-k5vwd 1/1 Terminating 0 40m
cdi cdi-operator-7bc764dbb8-vfvp2 1/1 Running 0 11m
cdi cdi-uploadproxy-886895848-dqw7z 1/1 Running 0 39m
default virt-launcher-vm-alpine-datavolume-2wxkl 1/1 Terminating 0 22m
default virt-launcher-vm-alpine-datavolume-hg5jl 1/1 Running 0 18m
doublehaul ➜ ~ kubectl describe vmi
Name: vm-alpine-datavolume
Namespace: default
Labels: kubevirt.io/migrationTargetNodeName=kube-3.novalocal
kubevirt.io/nodeName=kube-2.novalocal
kubevirt.io/vm=vm-alpine-datavolume
Annotations: <none>
API Version: kubevirt.io/v1alpha3
Kind: VirtualMachineInstance
Metadata:
Networks:
Name: default
Pod:
Volumes:
Data Volume:
Name: alpine-dv
Name: datavolumedisk1
Status:
Conditions:
Last Probe Time: <nil>
doublehaul ➜ demo-manifests kubectl describe vmi
Name: vm-alpine-datavolume
Namespace: default
Labels: kubevirt.io/nodeName=kube-node-1.novalocal
kubevirt.io/vm=vm-alpine-datavolume
Annotations: <none>
API Version: kubevirt.io/v1alpha3
Kind: VirtualMachineInstance
Metadata:
Creation Timestamp: 2019-03-06T23:31:57Z
doublehaul ➜ kubevirt git:(fixup-external-provider) ✗ CONTAINER_PREFIX=index.docker.io/jgriffith CONTAINER_TAG=latest make bazel-push-images
hack/dockerized "bazel run \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \
--workspace_status_command=./hack/print-workspace-status.sh \
--define container_prefix=index.docker.io/jgriffith \
--define container_tag=latest \
//:push-images"
Sending build context to Docker daemon 3.584kB
Step 1/7 : FROM kubevirt/builder@sha256:cd662847df816a0c5cf1a99dcb905301d305befe93d50bee8d00fdd5c74beb19
---> 75f2ffedcf24
go version go1.11.5 linux/amd64
Starting local Bazel server and connecting to it...
INFO: Invocation ID: a3ad9cf4-b08e-41e1-8f0b-8c8737a3e01c
DEBUG: /root/.cache/bazel/_bazel_root/6f347497f91c9a385dcd9294645b76e0/external/bazel_skylib/skylark_library.bzl:23:1: WARNING: skylark_library.bzl is deprecated and will go away in the future, please use bzl_library.bzl instead.
INFO: Analysed target //:push-images (543 packages loaded, 13139 targets configured).
INFO: Found 1 target...
Target //:push-images up-to-date:
bazel-bin/push-images
INFO: Elapsed time: 50.242s, Critical Path: 17.91s
INFO: 0 processes.
@j-griffith
j-griffith / gist:4e3dd034fa121d534211c23279b1308f
Created February 26, 2019 17:52
Deploy Ceph RBD (CSI) using Rook
# From the root dir of the Rook repo
kubectl create -f cluster/examples/kubernetes/cep/operator.yaml
kubectl create -f cluster/examples/kubernetes/cep/cluster.yaml
kubectl create namespace rook-ceph-system
# create rbac. Since rook operator is not permitted to create rbac rules, these rules have to be created outside of operator
kubectl apply -f cluster/examples/kubernetes/ceph/csi/rbac/rbd/
kubectl apply -f cluster/examples/kubernetes/ceph/csi/rbac/cephfs/
kubectl create configmap csi-cephfs-config -n rook-ceph-system --from-file=cluster/examples/kubernetes/ceph/csi/template/cephfs
// GitPopulator provides a struct for populating PVCs with data form a Git repo
type GitPopulator struct {
Repo string `json:"repo"`
Branch string `json:"branch,omitempty"`
Tag string `json:"tag,omitempty"`
}
// HTTPPopulator provides a struct for populating PVCs with data from a simple HTTP source
type HTTPPopulator struct {
URL string `json:"url"`