Skip to content

Instantly share code, notes, and snippets.

@janeczku
janeczku / registries.yaml
Created April 22, 2022 13:38
Configure Harvester to use private container registry
# Replace private.registry.com with the host name of your private container registry
# Save as /etc/rancher/rke2/registries.yaml on each Harvester server
mirrors:
docker.io:
endpoint:
- "https://private.registry.com"
private.registry.com:
endpoint:
- "https://private.registry.com"
configs:
@janeczku
janeczku / volume-snapshot-rke.md
Last active November 14, 2023 09:54
How to use the K8s Volume Snapshot Subsystem with Rancher RKE

Here are the steps to enable and test the Kubernetes Volume Snaphot subsystem on Rancher RKE or RKE2.

Deploying the volume snapshot controller and CRDs is required for managing snapshots for storage providers such as Longhorn, Rook/Ceph via the native K8s API as well as for integrating Rancher-managed clusters with backup solutions like Kasten K10.

1. Clone the repository

export SNAPSHOT_CTRL_VER=v5.0.1
git clone -b $SNAPSHOT_CTRL_VER https://github.com/kubernetes-csi/external-snapshotter.git
cd external-snapshotter
@janeczku
janeczku / ngin.md
Created February 18, 2022 12:20
Example Rancher NGINX config
worker_processes 4;
worker_processes 4;
worker_rlimit_nofile 40000;

events {
    worker_connections 8192;
}

http {
@janeczku
janeczku / import.sh
Last active August 1, 2023 01:33
Import Cluster in Rancher 2.6.x
#!/usr/bin/env bash
set -xe
RANCHER_HOST="REDACTED.cloud"
BEARER_TOKEN="token-hcjwf:REDACTED"
if [[ $# -eq 0 ]] ; then
echo "please specify cluster name"
exit 1
fi
@janeczku
janeczku / docker-config.md
Created December 13, 2021 11:55
Example Docker CLI registry auth config

/home/USER/.docker/config.json

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx="
        },
        "quay.io": {
 "xxxx": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
@janeczku
janeczku / containerd-registry.md
Last active December 13, 2021 11:44
How to overwrite the Docker Hub default registry in the ContainerD Runtime

To configure a new default registry that will be used to pull images that do not have fully qualified image paths, modify the containerd configuration (/etc/containerd/config.toml) as follows:


version = 2
[plugins]
  [plugins."io.containerd.grpc.v1.cri"]
    [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
 endpoint = ["https://private.registry.com:443"]
@janeczku
janeczku / dhcp.md
Created December 13, 2021 09:20
Harvester Network Config Examples
#cloud-config
version: 1
config:
  - type: physical
    name: eth0
    subnets:
      - type: dhcp
  - type: physical
 name: eth1
@janeczku
janeczku / config-create.yaml
Last active November 22, 2021 14:00
Harvester IPXE Boot Files
token: changeme
os:
hostname: harvey
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4dPexLIQWUjATwjGGX0LbKXADFSj9mUWFACYDqVRzDF3Dx+G7OssPekHKKFREN1MQOMfHQgJep1avdrQom0HEEjjzWxuKHi8J8wfcb3H7xZr6ojTv6xPpJfvY9IWDqWjLpvXkSeb9dmUClXZk7mvhAIt7s+wtUhlG8ZRDWZ8k2R17tcy9L73oHzW+7DyLflkJoetjYPrew9ifyaH/WFIqtEX7NHdIHHSQoxlWNxf+QzVB4DmYMOzf/FHiKCwNuqEUhbB4h3yWUUKiB/5/psD2CGDnAlN0whHXGSJqn6DeyG7xBnsxg0T5k9OsX65KNSOAgrr/1grtL0Nz7+ll0Ylp
password: rancher
dns_nameservers:
- 8.8.8.8
- 1.1.1.1
install:
@janeczku
janeczku / userdata.yaml
Created August 18, 2021 19:38
Exclude NICs for reporting VM IP addresses with Open VM / VMware Tools
#cloud-config
write_files:
- path: /etc/vmware-tools/tools.conf
permissions: 0644
content: |
[guestinfo]
# Ref: https://docs.vmware.com/en/VMware-Tools/11.3.0/com.vmware.vsphere.vmwaretools.doc/GUID-ECCF9D01-3666-40CE-B9FD-7EE0738AB5D9.html
exclude-nics=docker*,veth*,flannel*,cni*,calico*,ens193
primary-nics=ens192
@janeczku
janeczku / gosund_sp1.yaml
Last active March 21, 2023 09:44
Gosund SP1 + Esphome
substitutions:
devicename: gosund_sp1_01
friendlyname: SP1 Socket 01
sp1_current_resistor: "0.00221"
sp1_voltage_divider: "871"
#############
# Note: These numbers were found online
# BW SHP2 Current Resistor: 0.0028
# BW SHP2 Voltage Devider: 960
# Gosund SP1 Current Resistor: 0.00221