Skip to content

Instantly share code, notes, and snippets.

@yijia2413
Last active October 31, 2019 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yijia2413/006b0e432da9ff0b38241b60daea1f70 to your computer and use it in GitHub Desktop.
Save yijia2413/006b0e432da9ff0b38241b60daea1f70 to your computer and use it in GitHub Desktop.
k8s operations
# start proxy allow remote access
kubectl proxy --address=0.0.0.0 --port=80 --accept-hosts='^*$'
# port forward
kubectl --address 0.0.0.0 port-forward redis-test1-xxxx 6379:6379
# check pod startup issue
kubectl describe pod [my-pod-name] -n [kube-system](namespace)
# show all pods
kubectl get pods --all-namespaces
# delete pod and restart again
kubectl delete pod [pod-name] -n [pod-namespace]
# delte pod permanently
kubectl get deployments --all-namespaces
kubectl delete -n NAMESPACE deployment DEPLOYMENT
# delete by yaml
kubectl delete -f xxx.yml
kubectl get svc --all-namespaces=true
# delete all
kubectl --namespace=kube-system delete deployment,service,role,rolebinding,sa,secret -l k8s-app=kubernetes-dashboard
# get with more content
kubectl get secret,sa,role,rolebinding,services,deployments -n kube-system
# after deply ingress nginx, try
curl -k -v http://ip:port -H 'host: your.hostname.defined'
# by proxy
http://server_ip/api/v1/namespaces/default/services/nginx/proxy/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment