Skip to content

Instantly share code, notes, and snippets.

@danpaul81
Last active January 26, 2026 12:27
Show Gist options
  • Select an option

  • Save danpaul81/d2be60cb37cad677040c83b3e331c9c9 to your computer and use it in GitHub Desktop.

Select an option

Save danpaul81/d2be60cb37cad677040c83b3e331c9c9 to your computer and use it in GitHub Desktop.
Storkctl clusterpair containerized creation
- Build containerized storkctl using attached Dockerfile (or use image source provided in storkctl.yml)
- Create secrets containing kubeconfig files of cluster1 and cluster2
kubectl create secret generic --from-file=config1 kubeconfig1
kubectl create secret generic --from-file=config2 kubeconfig2
check bucket/region/endpoint... setting in configmap.yml & apply
add secret to secret.yml & apply
apply storkctl.yml
check job status & logs
apiVersion: v1
kind: ConfigMap
metadata:
name: storkctl-cm
data:
CP_NAME: clusterpair1
PROVIDER: s3
S3_BUCKET: dpaul-demo
S3_REGION: eu-west-1
S3_ENDPOINT: s3.amazonaws.com
FROM --platform=linux/amd64 golang:1.20-alpine3.18 AS build
RUN wget -P / https://github.com/libopenstorage/stork/archive/refs/tags/v23.11.0.tar.gz
RUN tar -xzf /v23.11.0.tar.gz
RUN cd stork-23.11.0/cmd/storkctl/; go install
FROM --platform=linux/amd64 alpine:3.18
COPY --from=build /go/bin/storkctl /root/go/bin/storkctl
apiVersion: v1
kind: Secret
metadata:
name: s3-secret
type: Opaque
data:
S3_ACCESS_KEY: base64AwsAccessKey
S3_SECRET_KEY: base64AwsSecretKey
apiVersion: batch/v1
kind: Job
metadata:
name: storkctl-clusterpair
spec:
template:
spec:
containers:
- name: storkctl
image: ghcr.io/danpaul81/storkctl:latest
envFrom:
- secretRef:
name: s3-secret
- configMapRef:
name: storkctl-cm
command: ["/root/go/bin/storkctl"]
args: ["create","clusterpair","$(CP_NAME)","--namespace","kube-system","--src-kube-file","/kubeconfig1/config1","--dest-kube-file","/kubeconfig2/config2","--bucket","$(S3_BUCKET)","--s3-region","$(S3_REGION)","--provider","$(PROVIDER)","--s3-endpoint","$(S3_ENDPOINT)","--s3-access-key","$(S3_ACCESS_KEY)","--s3-secret-key","$(S3_SECRET_KEY)","--unidirectional"]
volumeMounts:
- mountPath: "/kubeconfig1"
name: kubeconfig1
readOnly: true
- mountPath: "/kubeconfig2"
name: kubeconfig2
readOnly: true
volumes:
- name: kubeconfig1
secret:
secretName: kubeconfig1
- name: kubeconfig2
secret:
secretName: kubeconfig2
restartPolicy: Never
backoffLimit: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment