Skip to content

Instantly share code, notes, and snippets.

@awgreene
Last active October 19, 2022 21:01
Show Gist options
  • Save awgreene/65bb797e80d149470d90964be71e26a9 to your computer and use it in GitHub Desktop.
Save awgreene/65bb797e80d149470d90964be71e26a9 to your computer and use it in GitHub Desktop.
Rukpak Demo

RukPak Demo

This demo showcases how to install the prometheus operator with RukPak!

Prerequisites

Install Cert Manager

$ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.10.0/cert-manager.yaml

Install RukPak

$ kubectl apply -f https://github.com/operator-framework/rukpak/releases/latest/download/rukpak.yaml

Demo:

  1. Install the prometheus operator using a bundleDeployment
$ kubectl apply -f -<<EOF
apiVersion: core.rukpak.io/v1alpha1
kind: BundleDeployment
metadata:
  name: prometheus
spec:
  provisionerClassName: core-rukpak-io-plain
  template:
    metadata:
      labels:
        app: prometheus
    spec:
      provisionerClassName: core-rukpak-io-registry
      source:
        type: image
        image:
          ref: quay.io/agreene/prometheus:v1
EOF
bundledeployment.core.rukpak.io/prometheus created
  1. Check that the prometheus bundleDeployment was installed successfully:
$ kubectl get bundledeployments
NAME         ACTIVE BUNDLE       INSTALL STATE           AGE
prometheus   prometheus-z55c54   InstallationSucceeded   6m21s
  1. Check that the expected resources were created
$ kubectl get bundles
NAME                TYPE    PHASE      AGE
prometheus-z55c54   image   Unpacked   7m16s

$ kubectl get pods -n prometheus-system
NAME                                   READY   STATUS    RESTARTS   AGE
prometheus-operator-5bbbb6b6cf-tvpv4   1/1     Running   0          14s

$ kubectl get crds
NAME                                        CREATED AT
alertmanagerconfigs.monitoring.coreos.com   2022-10-19T15:08:23Z
alertmanagers.monitoring.coreos.com         2022-10-19T15:08:23Z
bundledeployments.core.rukpak.io            2022-10-19T14:58:05Z
bundles.core.rukpak.io                      2022-10-19T14:58:05Z
certificaterequests.cert-manager.io         2022-10-19T14:51:00Z
certificates.cert-manager.io                2022-10-19T14:51:00Z
challenges.acme.cert-manager.io             2022-10-19T14:51:00Z
clusterissuers.cert-manager.io              2022-10-19T14:51:00Z
issuers.cert-manager.io                     2022-10-19T14:51:00Z
orders.acme.cert-manager.io                 2022-10-19T14:51:00Z
podmonitors.monitoring.coreos.com           2022-10-19T15:08:23Z
probes.monitoring.coreos.com                2022-10-19T15:08:23Z
prometheuses.monitoring.coreos.com          2022-10-19T15:08:23Z
prometheusrules.monitoring.coreos.com       2022-10-19T15:08:23Z
servicemonitors.monitoring.coreos.com       2022-10-19T15:08:23Z
thanosrulers.monitoring.coreos.com          2022-10-19T15:08:23Z

$ kubectl get deployments -n prometheus-system
NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
prometheus-operator   1/1     1            1           56s
  1. Update the bundle referenced by the bundleDeployment
$ kubectl patch bundledeployment prometheus --type=merge -p '{"spec": {"template": {"spec":{"source": {"image": {"ref": "quay.io/agreene/prometheus:v2"}}}}}}'
bundledeployment.core.rukpak.io/prometheus patched
  1. Check that the bundle is being updated:
$ kubectl get bundles
NAME                TYPE    PHASE      AGE
prometheus-dcdxz5   image   Pending    1s
prometheus-z55c54   image   Unpacked   25s
  1. Check that the deployment now points to the new bundle and confirm that the old bundle was deleted
$ kubectl get bundledeployment
NAME         ACTIVE BUNDLE       INSTALL STATE           AGE
prometheus   prometheus-dcdxz5   InstallationSucceeded   5m10s

$ kubectl get bundles
NAME                TYPE    PHASE      AGE
prometheus-dcdxz5   image   Unpacked    20s
  1. Uninstall the prometheus operator
$ kubect delete bundledeployment prometheus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment