- A running KubeSphere cluster (Kubernetes version >v1.15.x <v1.19.x)
- Go (>1.11.x)
- Docker (18.x)
- Telepresence - for debugging (https://www.telepresence.io/ )
- kubebuilder (latest stable version is ok https://github.com/kubernetes-sigs/kubebuilder)
- More tools for debugging https://github.com/kubernetes/community/blob/master/contributors/devel/development.md#installing-required-software
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -x | |
| node=${1} | |
| nodeName=$(kubectl get node ${node} -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}') | |
| nodeSelector='"nodeSelector": { "kubernetes.io/hostname": "'${nodeName:?}'" },' | |
| podName=exec-${node} | |
| kubectl run ${podName:?} --restart=Never -it --rm --image overriden --overrides ' | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "github.com/emicklei/go-restful" | |
| "net/http" | |
| "time" | |
| ) | |
| func downloadHandler(request *restful.Request, response *restful.Response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "fmt" | |
| esv5 "github.com/elastic/go-elasticsearch/v5" | |
| esv6 "github.com/elastic/go-elasticsearch/v6" | |
| esv7 "github.com/elastic/go-elasticsearch/v7" | |
| ) | |
| type ES_VERSION string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kubectl delete csr --all | |
| kubectl get node -lrole!=master -o=jsonpath='{range .items[*]}{.status.addresses[0].address}{"\n"}{end}' | xargs -I {} ssh {} "rm /etc/kubernetes/kubelet.conf && systemctl restart kubelet" | |
| kubectl get csr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # make sure this script executed on master node | |
| source /data/kubernetes/env.sh | |
| # backup master node certificates | |
| cp -r /etc/kubernetes/pki /etc/kubernetes/pki_backup | |
| # remove expired certificates | |
| rm /etc/kubernetes/pki/apiserver-kubelet-client.crt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source /data/kubernetes/env.sh | |
| KUBECONFIG=`base64 /etc/kubernetes/admin.conf | tr -d "\n"` | |
| INITTOKEN=`kubeadm token list | grep forever | awk '{print $1}'` | |
| JSON="{\"clusters\":{\"CLUSTERID\":{\"hosts\":{\"master\":{\"INSTANCEID\":{\"token\":\"{\\\"init_token\\\":\\\"INITTOKEN\\\",\\\"adminconf\\\":\\\"KUBECONFIG\\\"}\"}}}}}}" | |
| echo $JSON | sed -e "s/CLUSTERID/${CLUSTER_ID}/g" | sed -e "s/INSTANCEID/${HOST_INSTANCE_ID}/g" | sed -e "s/INITTOKEN/${INITTOKEN}/g" | sed -e "s/KUBECONFIG/${KUBECONFIG}/g" > token.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: istio/charts/prometheus/templates/configmap.yaml | |
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: prometheus | |
| namespace: istio-system | |
| labels: | |
| app: prometheus | |
| chart: prometheus-1.0.6 | |
| release: istio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import os | |
| import json | |
| import urllib2 | |
| import logging | |
| import logging.handlers | |
| import subprocess | |
| import time | |
| import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: netshoot | |
| labels: | |
| app: netshoot | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: |
NewerOlder