kubectl proxy
kubectl get ns | grep Terminating | awk '{print $1}' | xargs  -n1 -- bash -c 'kubectl get ns "$0" -o json | jq "del(.spec.finalizers[0])" > "$0.json"; curl -k -H "Content-Type: application/json" -X PUT --data-binary @"$0.json" "http://127.0.0.1:8001/api/v1/namespaces/$0/finalize" '
  
    
      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 patch cronjobs <job-name> -p '{"spec" : {"suspend" : true }}' | 
  
    
      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
    
  
  
    
  | # Change the default browser to brave. | |
| xdg-settings set default-web-browser brave-browser.desktop | 
  
    
      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
    
  
  
    
  | ssh-keygen -t rsa -b 4096 -m PEM -f <keyname> | 
  
    
      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
    
  
  
    
  | ssh-keygen -E md5 -lf ~/.ssh/id_rsa.pub | 
  
    
      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
    
  
  
    
  | docker login | |
| cat <<EOF | kubectl apply -f - | |
| apiVersion: v1 | |
| kind: Secret | |
| metadata: | |
| name: registrypullsecret | |
| data: | |
| .dockerconfigjson: "$(cat ~/.docker/config.json | base64 | tr -d '\n')" | |
| type: kubernetes.io/dockerconfigjson | 
  
    
      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
    
  
  
    
  | ################## | |
| ### BETTER WAY ### | |
| ################## | |
| cat <<EOF | kubectl apply -f - | |
| kind: ClusterRole | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| metadata: | |
| name: admin-role | |
| rules: | 
  
    
      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
    
  
  
    
  | kubeadm token create --print-join-command | 
This setup will make weave behave correctly (the pod-network-cidr). The HOST_IP should be the IP the nodes can access.
kubeadm init --apiserver-advertise-address=HOST_IP --pod-network-cidr=10.4.0.0/16 --apiserver-cert-extra-sans=EXTERA_IPS
mkdir -p /home/arsham/.kube
cp -i /etc/kubernetes/admin.conf /home/arsham/.kube/config
chown arsham:arsham /home/arsham/.kube/configkubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')&env.IPALLOC_RANGE=10.4.0.0/16"
kubectl apply -f "https://cloud.weave.works/k8s/scope.yaml?k8s-service-type=NodePort&k8s-version=$(kubectl version | base64 | tr -d '\n')"kubectl port-forward -n weave "$(kubectl get -n weave pod --selector=weave-scope-component=app -o jsonpath='{.items..metadata.name}')" 4040NewerOlder