Skip to content

Instantly share code, notes, and snippets.

Wenzhi Liang wzhliang

Block or report user

Report or block wzhliang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wzhliang
wzhliang / default.md
Last active Dec 5, 2019
dotnet wcfservice docker run fail on MacOS
View default.md

$ docker run mcr.microsoft.com/dotnet/framework/samples:wcfservice

Unable to find image 'mcr.microsoft.com/dotnet/framework/samples:wcfservice' locally wcfservice: Pulling from dotnet/framework/samples docker: no matching manifest for linux/amd64 in the manifest list entries. See 'docker run --help'.

View merge_repos.sh
#!/bin/bash
# This script takes a remote repository and merges it into
# the current one as a subdirectory
set -e
if [ -z "$1" ]
then
echo "Usage:"
@wzhliang
wzhliang / k8s-ipvs-cli.txt
Created May 13, 2019
kubernetes kube-proxy IPVS CLI illustration
View k8s-ipvs-cli.txt
# kubectl describe svc nginx-service
Name: nginx-service
...
Type: ClusterIP
IP: 10.102.128.4
Port: http 3080/TCP
Endpoints: 10.244.0.235:8080,10.244.1.237:8080
Session Affinity: None
# ip addr
@wzhliang
wzhliang / ansible_dir_layout.txt
Created Jan 28, 2019
Ansible directory layout
View ansible_dir_layout.txt
production # inventory file for production servers
staging # inventory file for staging environment
group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to particular systems
hostname2.yml
@wzhliang
wzhliang / prom-operator-alert-rule.txt
Created Jan 25, 2019
Prometheus operator alert rule
View prom-operator-alert-rule.txt
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
prometheus: service-prometheus
role: alert-rules
name: prometheus-service-rules
namespace: monitoring
spec:
groups:
@wzhliang
wzhliang / prom-operator-am.txt
Created Jan 25, 2019
Prometheus operator AM CRD
View prom-operator-am.txt
kubectl get alertmanager main -n monitoring -o yaml
apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
clusterName: ""
creationTimestamp: 2018-08-28T09:15:25Z
labels:
alertmanager: main
name: main
namespace: monitoring
@wzhliang
wzhliang / prom-storage-conf.txt
Created Jan 25, 2019
Prometheus storage configuration
View prom-storage-conf.txt
containers:
- args:
- --storage.tsdb.path=/data
- --storage.tsdb.retention=400d
@wzhliang
wzhliang / 001.txt
Created Jan 25, 2019
prometheus alert configuration
View 001.txt
groups:
- name: etcd
rules:
- alert: NoLeader
expr: etcd_server_has_leader{job="kube-etcd"} == 0
for: 1m
labels:
severity: critical
k8s-component: etcd
annotations:
@wzhliang
wzhliang / testvm.yaml
Created Jan 9, 2019
kubectl get vms output (kubevirt)
View testvm.yaml
apiVersion: kubevirt.io/v1alpha2
kind: VirtualMachine
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"kubevirt.io/v1alpha2","kind":"VirtualMachine","metadata":{"annotations":{},"name":"testvm","namespace":"default"},"spec":{"running":false,"template":{"metadata":{"labels":{"kubevirt.io/domain":"testvm","kubevirt.io/size":"small"}},"spec":{"domain":{"devices":{"disks":[{"disk":{"bus":"virtio"},"name":"containerdisk","volumeName":"containervolume"},{"disk":{"bus":"virtio"},"name":"cloudinitdisk","volumeName":"cloudinitvolume"}],"interfaces":[{"bridge":{},"name":"default"}]},"resources":{"requests":{"memory":"64M"}}},"networks":[{"name":"default","pod":{}}],"volumes":[{"containerDisk":{"image":"kubevirt/cirros-registry-disk-demo"},"name":"containervolume"},{"cloudInitNoCloud":{"userDataBase64":"SGkuXG4="},"name":"cloudinitvolume"}]}}}}
creationTimestamp: 2019-01-09T00:47:00Z
generation: 1
name: testvm
namespace: default
@wzhliang
wzhliang / start.sh
Created Jan 9, 2019
Starting Minikube behind proxy on MacOS
View start.sh
minikube start --docker-env=http_proxy=http://192.168.1.6:2080 --docker-env=https_proxy=http://192.168.1.6:2080
You can’t perform that action at this time.