Skip to content

Instantly share code, notes, and snippets.

janeczku /
Last active February 20, 2024 11:59
K8s External Service Example

Customizing CoreDNS configmap

Generally you should use K8s services objects to define custom DNS mappings. However some advanced DNS setups might not be possible then, for example if you need to create wildcard DNS aliases.

In this case, you can create custom DNS records in the cluster's internal DNS service (kube-dns) by editing the coredns configmap like below. Here we are adding the file plugin to describe an authoritative zone containing a wildcard A record and we also create the required zone file.

apiVersion: v1
kind: ConfigMap
janeczku /
Created February 13, 2024 18:49
Neuvector Trickkiste

Insiderwissen NeuVector

Zero Drift

  • So while in zero drift mode if the process that you are blocking is either pid 1 or is started by pid 1 then Neuvector will not block it
  • Zero drift is more permissive that basic mode! :-P
  • Zero drift mode would seem to enforce more secure configurations? Do you know why it allows for more permissive actions?
  • NeuVector will not block processes that are also used by Kubernetes.
janeczku /
Created February 13, 2024 11:50
Batch delete finalizers Kubernetes
kubectl patch -n hobbyfarm $1 \
--type json \
--patch='[ { "op": "remove", "path": "/metadata/finalizers" } ]'
RESOURCES=$(kubectl -n hobbyfarm get --no-headers -o custom-columns="")
for n in $RESOURCES
janeczku /
Last active February 2, 2024 15:04
User-space NFS Server for deployment in Kubernetes (Note: NFSv4 only, non-standard NFS port 32049/tcp)


  1. Deploy NFS server to a K8s cluster
kubectl apply -f
  1. In the same or a different cluster create a NFS backup target in Longhorn:
    a) Navigate to Longhorn UI -> Settings -> General -> Backup target
    b) Enter the following URL, replacing with the IP address of any node of the K8s cluster running the NFS server, then click 'Save':
janeczku /
Created November 10, 2023 13:41
Configure RKE2 to expose the Nginx Ingress behind a Metallb VIP
  1. Before installing RKE2 on the node create the following file:
# /var/lib/rancher/rke2/server/manifests/rke2-ingress-nginx-config.yaml
kind: HelmChartConfig
  name: rke2-ingress-nginx
 namespace: kube-system
janeczku / cpu-pin-test-deploy.yaml
Created July 27, 2022 16:55
K8s CPU Pinning Test Workload
apiVersion: apps/v1
kind: Deployment
name: cpu-stress
namespace: default
replicas: 3
app: cpu-stress
janeczku / app.yaml
Last active July 12, 2022 16:45
Configure multicast-compatible macvlan interfaces with Multus
apiVersion: apps/v1
kind: Deployment
name: test
replicas: 1
app: test
janeczku / rancher-cluster-event-source.yaml
Created July 5, 2022 13:59
Argo Event: Trigger on Rancher Cluster Provisioning
kind: EventSource
name: resource
serviceAccountName: your-service-account
namespace: fleet-default
janeczku / create-config.yaml
Last active June 8, 2022 14:41
Harvester: Adding a custom systemd unit using oem cloud-config
# Adding the following config stanza to all the Harvester create|join configs will create
# a custom cloud-config `/oem/95_user.yaml` during the (early) "initramfs" cloud-init stage
# of the initial Harvester boot.
# This cloud-config will be executed on each system (re-)boot during the (late) "boot" cloud-init
# stage and may contain any cloud-init directives supported by the cOS Toolkit:
# See
# Additionally, any files added to the /oem folder in day-2 are persistent and won’t be overwritten
# during Harvester upgrades.
janeczku / 95_user.yaml
Created June 3, 2022 08:46
Harvester: Adding a custom systemd unit using oem cloud-config
# Filename: /oem/95_user.yaml
# Ref:
name: "User Config"
- name: "Drop unit file"
- path: /etc/systemd/system/update-ca.service
content: |