Skip to content

Instantly share code, notes, and snippets.

#!/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:
#!/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/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
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
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: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
app.kubernetes.io/name: cadvisor
app.kubernetes.io/instance: cadvisor
name: cadvisor
spec:
selector:
matchLabels:
@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
#!/bin/bash -xe
apt-get install -yq md5deep wget fakeroot
[ -z "${GO_VERSION}" ] && GO_VERSION=1.17
mkdir -p /tmp/golang/{DEBIAN,usr/local}
cd /tmp/golang/
wget https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz
export DOCKER_CLI_EXPERIMENTAL=enabled
export TAG=0.32.0
export _PULL_BASE_REF="master"
export REGISTRY=egeneralov
go get -v k8s.io/ingress-nginx
cd ~/go/src/k8s.io/ingress-nginx
git checkout controller-0.32.0
sed -i -e 's/^ALL_ARCH.*/ALL_ARCH = amd64/g' Makefile
sed -i 's/amd64 arm arm64/amd64/g' images/nginx/Makefile
kubectl -n backup delete job/kubespray
cat << EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
labels:
app: kubespray
name: kubespray
namespace: backup