Skip to content

Instantly share code, notes, and snippets.

@Knappek
Knappek / deploy-ubuntu-on-vcenter.sh
Last active December 12, 2024 09:35
deploy ubuntu VM on vCenter with public ssh key distributed and a static IP address
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
# Prompt for GOVC environment variables if not already set
: "${GOVC_URL:?ESX or vCenter URL (e.g., https://1.2.3.4:443): }"
: "${GOVC_USERNAME:=administrator@vsphere.local}"
: "${GOVC_PASSWORD:=VMware1!}"
@Knappek
Knappek / ytt-overlay-unwanted-route-filter.yml
Last active February 19, 2025 13:52
YTT exclude unwanted routes
#@data/values
---
unwanted_routes:
- method: "GET"
path: "/api/foo"
- method: "GET"
path: "/api/3"
- method: "POST"
path: "/api/bla"
kind: Policy
rules:
# The following requests were manually identified as high-volume and low-risk,
# so drop them.
- level: None
users: ["system:serviceaccount:kube-system:kube-proxy"]
verbs: ["watch"]
resources:
- group: "" # core
resources: ["endpoints", "services", "services/status"]
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
annotations:
run.tanzu.vmware.com/resolve-tkr: ""
name: custom-audit-policy
namespace: auditing
spec:
controlPlane:
machineHealthCheck:
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.all
---
instance_groups:
#@overlay/match by=overlay.subset({"name": "postgres-instance"})
- jobs:
#@overlay/match by=overlay.subset({"name": "postgres"})
- properties:
databases:
@Knappek
Knappek / install-k3s-with-multipass.sh
Last active May 5, 2025 11:31
Usage: ./install-k3s-with-multipass.sh -h
#!/bin/bash
show_help() {
cat <<EOF
Usage: $0 --control-plane-nodes <nodes> --worker-nodes <count> --name <name>
[--control-plane-cpus <cpus>] [--control-plane-memory <memory>]
[--worker-cpus <cpus>] [--worker-memory <memory>]
[--ssh-public-key <path>] [--ssh-private-key <path>]
[--control-plane-disk <disk>] [--worker-disk <disk>]
[-h|--help]