Giter Club home page Giter Club logo

gke-workshops-demo's Introduction

gke-workshops-demo

debug a failed pod with labeling it so that it's removed from a prod replicaset

kubectl label pods kuard-prod-75b665f5f6-c52wh track=failed  --overwrite

kubectl cheat sheet

run

kubectl run -l app=other --image=alpine --restart=Never --rm -i -t test-1

kubectl run hello-web --labels app=hello \
  --image=gcr.io/google-samples/hello-app:1.0 --requests=cpu=200m --port 8080 --expose
  
kubectl run -it --rm --image=mysql:5.6 --restart=Never -n prod mysql-client \
  -- sh -c 'apt-get update && apt-get install -y dnsutils && nslookup sqlproxy && mysql -h sqlproxy -uuser -ppassword'
  
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h 1.2.3.4 -uuser -ppassword --execute 'show databases;'  

expose

kubectl expose deployment nginx --type=NodePort --name nginx --port 80

kubectl expose deployment iis --type="LoadBalancer" --name=iis --port=80 --target-port=80

get / delete

kubectl get pods -l=app=kuard  
kubectl delete pod -l app=kuard

kubectl delete -f filewithmoreobjectsdefined.yaml

kubectl delete pod $(kubectl get pods | grep 0/1 | awk '{print $1}')

kubectl delete pv --all
kubectl delete pvc --all

watch kubectl get ep,svc,po,ing -o wide --show-labels

kubectl get all --all-namespaces -o yaml --export

apply

kubectl apply --recursive -f clusterrolebindings.rbac.authorization.k8s.io/

kubectl create clusterrolebinding cluster-admin-binding \
  --clusterrole cluster-admin --user $(gcloud config get-value account)
  
for FOLDER in *; do echo "doing $FOLDER" ; kubectl apply --recursive --validate=false -v=4 -f ./$FOLDER; done

edit

kubectl edit cm config-autoscaler -n knative-serving
kubectl edit sts redis-cache-dev-master

logs

kubectl logs -f redis-cache-dev-master-0 -c volume-permissions

config

kubectl config view -o template --template='{{ index . "current-context" }}'

rollout

kubectl rollout status statefulset web

drain

kubectl drain gke-cluster-name-default-pool-426bc9ef-ngv3 --ignore-daemonsets --delete-local-data --v=4

useful aliases

alias util='kubectl get nodes --no-headers | awk '\''{print $1}'\'' | xargs -I {} sh -c '\''echo {} ; kubectl describe node {} | grep Allocated -A 5 | grep -ve Event -ve Allocated -ve percent -ve -- ; echo '\'''
util

gke-workshops-demo's People

Contributors

bartimar avatar kotaldav-revolgy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.