Skip to content

Instantly share code, notes, and snippets.

@jodykpw
jodykpw / nginx-load-balancer.yaml
Created August 11, 2020 23:48
Simple nginx load balancer example
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
@jodykpw
jodykpw / config.yaml
Created August 11, 2020 23:37
metalLB configmap
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
@jodykpw
jodykpw / rancher-cleanupdirs.sh
Last active July 10, 2020 21:39
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/etc/ceph* /etc/cni* /etc/kubernetes* /opt/cni* /opt/rke* /run/secrets/kubernetes.io* /run/calico* /run/flannel* /var/lib/calico* /var/lib/etcd* /var/lib/cni* /var/lib/kubelet* /var/lib/rancher/rke/log* /var/log/containers* /var/log/kube-audit* /var/log/pods* /var/run/calico*"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -Rf $dir
done
@jodykpw
jodykpw / racher-docker-compose.yml
Created July 10, 2020 00:30
Install Rancher on a Single Node Using Docker with Traefik
version: '3'
services:
rancher:
container_name: rancher
restart: always
image: rancher/rancher:v2.4.4
networks:
- traefik
labels:
@jodykpw
jodykpw / nginx.conf
Last active March 5, 2022 21:51
Harbor with Traefik, Nginx config.
worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
@jodykpw
jodykpw / error.txt
Last active June 9, 2020 16:28
Encountered errors while bringing up the project.
[Step 4]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating network "harbor_harbor-chartmuseum" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating registryctl ... done
Creating harbor-db ... done
Creating redis ... done
Creating chartmuseum ... done
Creating registry ... done
@jodykpw
jodykpw / harbor.yml
Last active June 9, 2020 16:18
Configuration file of Harbor
# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: reg.mydomain.com
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 80
@jodykpw
jodykpw / label
Created May 8, 2020 22:58
GitLab Traefik Dynamic configuration with Docker Labels
labels:
# Dynamic configuration with Docker Labels
# Ref: https://docs.traefik.io/reference/dynamic-configuration/docker/
- "traefik.enable=true"
- "traefik.http.routers.gitlab.entrypoints=web"
- "traefik.http.routers.gitlab.rule=Host(`gitlab.domain.com`)"
- "traefik.http.routers.gitlab.service=gitlab"
- "traefik.http.services.gitlab.loadbalancer.server.port=80"
- "traefik.http.routers.gitlab-registry.entrypoints=web"
- "traefik.http.routers.gitlab-registry.rule=Host(`registry.domain.com`)"
@jodykpw
jodykpw / docker-compose.yml
Last active May 7, 2020 23:05
Basic Traefik reverse proxy with Docker
version: '3'
services:
# The reverse proxy service (Traefik)
reverse-proxy:
# The official v2.2 Traefik docker image
image: "traefik:v2.2"
container_name: traefik
restart: unless-stopped
# Static Configuration CLI
@jodykpw
jodykpw / docker-compose.yml
Last active July 26, 2019 09:02
Portainer Management, Docker User Interface
version: '3'
services:
portainer:
container_name: portainer
restart: always
image: portainer/portainer
network_mode: bridge
ports:
- "9000:9000"