Skip to content

Instantly share code, notes, and snippets.

@egeneralov
egeneralov / .gitlab-ci.yml
Created June 10, 2020 19:46
gitlab ci build kernel image automatically
variables:
PAT: ""
stages:
- check
- build
kernel:
stage: build
image: debian:10
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
app.kubernetes.io/name: cadvisor
app.kubernetes.io/instance: cadvisor
name: cadvisor
spec:
selector:
matchLabels:
cat << EOF > /etc/opkg.conf
src/gz snapshots http://openwrt.wk.cz/trunk/mr-mips/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
EOF
opkg update
apiVersion: v1
kind: ConfigMap
metadata:
name: custom-headers
namespace: ingress-nginx
data:
X-geoip-area-code: $geoip_area_code
X-geoip-city-continent-code: $geoip_city_continent_code
X-geoip-city-country-code: $geoip_city_country_code
X-geoip-city-country-code3: $geoip_city_country_code3
#!/bin/bash -xe
curl -sL https://github.com/prometheus/node_exporter/releases/download/v1.0.0/node_exporter-1.0.0.linux-amd64.tar.gz | tar xzvf - -C /opt/
cat << EOF > /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
[Service]
ExecStart=/opt/node_exporter-1.0.0.linux-amd64/node_exporter --web.listen-address=0.0.0.0:9100
#!/bin/bash -xe
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
kubectl -n local-path-storage patch cm local-path-config -p '{"data":{"config.json":"{\n \"nodePathMap\": [\n {\n \"node\":\"DEFAULT_PATH_FOR_NON_LISTED_NODES\",\n \"paths\": [\n \"/data\"\n ]\n }\n ]\n}"}}'
kubectl -n local-path-storage patch deployment local-path-provisioner -p '{"spec":{"template":{"spec":{"$setElementOrder/containers":[{"name":"local-path-provisioner"}],"containers":[{"image":"egeneralov/local-path-provisioner:v0.0.12","name":"local-path-provisioner"}]}}}}'
kubectl patch storageclasses.storage.k8s.io local-path -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
#!/bin/sh -xe
for NAME in $(kubectl get nodes -o name | awk -F \/ '{print $2}'); do
cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: kube-support-$NAME
namespace: kube-system
spec:
@egeneralov
egeneralov / linux.sh
Last active April 21, 2025 22:16
linux to mikrotik ip tunnel
ip tunnel add ipip local ${linux_ip} remote ${mikrotik_ip} mode ipip
ip link set ipip up
ip addr add 192.168.3.1/30 dev ipip
iptables -t mangle -A POSTROUTING -o ipip -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -t nat -A POSTROUTING -s 192.168.3.0/30 -o ${linux_output_iface} -j MASQUERADE
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoserver
labels:
app: echoserver
spec:
replicas: 3
selector:
# helm repo add stable https://kubernetes-charts.storage.googleapis.com
# helm repo add elastic https://helm.elastic.co
# helm repo update
# terraform apply -auto-approve -no-color -var "access_key=" -var "secret_key=" -var "organization_id="
variable "access_key" {
type = string
}
variable "secret_key" {
type = string