Created
July 25, 2023 12:04
-
-
Save kirederik/6ebec38478fbdbcec9e76f3d015be5b9 to your computer and use it in GitHub Desktop.
multicluster-kratix-minikube.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minikube start -p kind-platform --ports=31337:31337 | |
minikube start -p kind-worker | |
export PLATFORM="kind-platform" | |
export WORKER="kind-worker" | |
kubectl --context $PLATFORM apply --filename distribution/kratix.yaml | |
# if running minio locally | |
kubectl --context $PLATFORM apply --filename config/samples/minio-install.yaml | |
# register the bucket | |
cat << EOF | kubectl --context $PLATFORM apply -f - | |
apiVersion: platform.kratix.io/v1alpha1 | |
kind: BucketStateStore | |
metadata: | |
name: minio-store | |
spec: | |
# change endpoint if using an external bucket like S3 | |
endpoint: minio.kratix-platform-system.svc.cluster.local | |
insecure: true | |
bucketName: kratix | |
secretRef: | |
name: minio-credentials | |
namespace: default | |
EOF | |
# install flux | |
kubectl --context $WORKER \ | |
apply \ | |
--filename https://github.com/fluxcd/flux2/releases/download/v2.0.0-rc.3/install.yaml | |
# Configure Flux on the worker cluster | |
# change the config options below if using an external bucket like S3 | |
cat <<EOF | kubectl --context $WORKER apply -f - | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: minio-credentials | |
namespace: flux-system | |
type: Opaque | |
stringData: | |
accesskey: minioadmin | |
secretkey: minioadmin | |
--- | |
apiVersion: source.toolkit.fluxcd.io/v1beta1 | |
kind: Bucket | |
metadata: | |
name: kratix-bucket | |
namespace: flux-system | |
spec: | |
interval: 10s | |
provider: generic | |
bucketName: kratix | |
endpoint: host.docker.internal:31337 | |
insecure: true | |
secretRef: | |
name: minio-credentials | |
EOF | |
# create the kustomizations; no changes are needed here | |
cat <<EOF | kubectl --context $WORKER apply --filename - | |
--- | |
apiVersion: kustomize.toolkit.fluxcd.io/v1 | |
kind: Kustomization | |
metadata: | |
name: kratix-workload-crds | |
namespace: flux-system | |
spec: | |
interval: 8s | |
prune: true | |
sourceRef: | |
kind: Bucket | |
name: kratix-bucket | |
path: ./worker-cluster/crds | |
--- | |
apiVersion: kustomize.toolkit.fluxcd.io/v1 | |
kind: Kustomization | |
metadata: | |
name: kratix-workload-resources | |
namespace: flux-system | |
spec: | |
interval: 3s | |
prune: true | |
dependsOn: | |
- name: kratix-workload-crds | |
sourceRef: | |
kind: Bucket | |
name: kratix-bucket | |
path: ./worker-cluster/resources | |
EOF | |
# register the worker cluster with the platform | |
cat <<EOF | kubectl --context $PLATFORM apply --filename - | |
apiVersion: platform.kratix.io/v1alpha1 | |
kind: Cluster | |
metadata: | |
name: worker-cluster | |
labels: | |
environment: dev | |
spec: | |
stateStoreRef: | |
name: minio-store | |
kind: BucketStateStore | |
EOF |
aclevername
commented
Jul 31, 2023
•
02c0079e20f156dd618971e1695baac74bfa2726
host.minikube.internal
# install flux
kubectl --context $WORKER \
apply -f \
hack/worker/gitops-tk-install.yaml
New Gist https://gist.github.com/syntassodev/51ee100d0b50cbed7ff6ccd1e4516284
Updated to work with commit SHA adf311209f195f29d9a246010c5c088adc5ef096 (image version: 02c0079e20f156dd618971e1695baac74bfa2726
):
minikube start -p kind-platform --ports=31337:31337
minikube start -p kind-worker
export PLATFORM="kind-platform"
export WORKER="kind-worker"
kubectl --context $PLATFORM apply --filename distribution/kratix.yaml
# if running minio locally
kubectl --context $PLATFORM apply --filename config/samples/minio-install.yaml
# register the bucket
cat << EOF | kubectl --context $PLATFORM apply -f -
apiVersion: platform.kratix.io/v1alpha1
kind: BucketStateStore
metadata:
name: minio-store
spec:
# change endpoint if using an external bucket like S3
endpoint: minio.kratix-platform-system.svc.cluster.local
insecure: true
bucketName: kratix
secretRef:
name: minio-credentials
EOF
# install flux
kubectl --context $WORKER \
apply -f \
hack/worker/gitops-tk-install.yaml
# Configure Flux on the worker cluster
# change the config options below if using an external bucket like S3
cat <<EOF | kubectl --context $WORKER apply -f -
---
apiVersion: v1
kind: Secret
metadata:
name: minio-credentials
namespace: flux-system
type: Opaque
stringData:
accesskey: minioadmin
secretkey: minioadmin
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: Bucket
metadata:
name: kratix-bucket
namespace: flux-system
spec:
interval: 10s
provider: generic
bucketName: kratix
endpoint: host.minikube.internal:31337
insecure: true
secretRef:
name: minio-credentials
EOF
# create the kustomizations; no changes are needed here
cat <<EOF | kubectl --context $WORKER apply --filename -
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
name: kratix-workload-crds
namespace: flux-system
spec:
interval: 8s
prune: true
sourceRef:
kind: Bucket
name: kratix-bucket
path: ./default/worker-cluster/crds
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
kind: Kustomization
metadata:
name: kratix-workload-resources
namespace: flux-system
spec:
interval: 3s
prune: true
dependsOn:
- name: kratix-workload-crds
sourceRef:
kind: Bucket
name: kratix-bucket
path: ./default/worker-cluster/resources
EOF
# register the worker cluster with the platform
cat <<EOF | kubectl --context $PLATFORM apply --filename -
apiVersion: platform.kratix.io/v1alpha1
kind: Cluster
metadata:
name: worker-cluster
labels:
environment: dev
spec:
stateStoreRef:
name: minio-store
kind: BucketStateStore
EOF
ghcr.io/fluxcd/helm-controller:v0.27.0
ghcr.io/fluxcd/kustomize-controller:v0.31.0
ghcr.io/fluxcd/notification-controller:v0.29.0
ghcr.io/fluxcd/source-controller:v0.32.1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment