Skip to content

Instantly share code, notes, and snippets.

@sebgoa
Created September 13, 2022 15:00
Show Gist options
  • Save sebgoa/c28a768b32cf36edbcfc0f08ca6b04c1 to your computer and use it in GitHub Desktop.
Save sebgoa/c28a768b32cf36edbcfc0f08ca6b04c1 to your computer and use it in GitHub Desktop.
kubectl get deployments
744 kubectl get rs
745 kubectl delete rs foo
746 clear
747 kubectl delete deployments oreilly
748 clear
749 kubectl get pods
750 kubectl get pods
751 clear
752 which kubectl
753 kubectl get nodes
754 kubectl get -v 9 nodes
755 clear
756 kubectl create deployment web --image=nginx --dry-run -o json
757 kubectl create deployment web --image=nginx
758 kubectl get deployments
759 kubectl get rs
760 kubectl get pods
761 kubectl describe pod web-68bdbdcb94-b5f26
762 kubectl get pods
763 kubectl get pods
764 kubectl get rs
765 kubectl get rs web-68bdbdcb94 -o yaml |more
766 kubectl get pods
767 kubectl get pods web-68bdbdcb94-b5f26 -o yaml|more
768 kubectl scale deployment web --replicas 3
769 kubectl get pods
770 kubectl get pods --show-labels
771 kubectl label pods web-68bdbdcb94-5s7kq app=notworking --overwrite
772 kubectl get pods --show-labels
773 clear
774 kubectl get deployments
775 kubectl edit deployments web
776 kubectl get rs
777 kubectl get rs
778 kubectl get pods
779 kubectl describe pods web-68bdbdcb94-b5f26
780 kubectl edit deployment web
781 kubectl get rs
782 kubectl get pods
783 kubectl edit deployment web
784 kubectl get rs
785 kubectl get pods
786 kubectl get pods -w
787 kubectl get pods
788 kubectl get pods
789 kubectl scale deployment web --replicas 1
790 kubectl get pods
791 kubectl get pods -w
792 clear
793 kubectl get pods
794 kubectl get pods
795 kubectl get pods --show-labels
796 kubectl delete pods web-68bdbdcb94-5s7kq
797 kubectl expose deployment web --port 80 --type NodePort
798 kubectl get services
799 kubectl get svc
800 minikube ip
801 curl http://192.168.64.25:31037
802 minikube service web
803 clear
804 kubectl get deployments
805 kubectl get rs
806 kubectl get pods
807 kubectl get svc
808 kubectl run --rm -it debug --image=busybox:1.27 -- /bin/sh
809 kubectl run --rm -it debug --image=busybox:1.27 -- /bin/sh
810 kubectl run --rm -it debug1 --image=busybox:1.27 -- /bin/sh
811 clear
812 minikube stop
813 minikube delete
814 minikube start
815 clear
816 kubectl get pods
817 kubectl apply -f https://raw.githubusercontent.com/kubernetes/examples/master/guestbook/all-in-one/guestbook-all-in-one.yaml
818 kubectl get pods
819 kubectl get pods -w
820 clear
821 kubectl get pods
822 kubectl scale deployment frontend --replicas 1
823 kubectl scale deployment redis-replica --replicas 3
824 kubectl get pods
825 kubectl get svc
826 kubectl get endpoints
827 kubectl scale deployment redis-replica --replicas 1
828 kubectl get endpoints
829 minikube service frontend
830 kubectl get pods
831 kubectl logs frontend-f7d9c57d4-rjj2b
832 kubectl logs v
833 kubectl logs redis-master-857d99cc8-tc54j
834 clear
835 ls -l
836 kubectl get svc
837 kubectl edit svc redis-replica
838 kubectl get svc
839 kubectl expose deployment redis-replica --port 6379 -o yaml --dry-run > svc.yaml
840 vi svc.yaml
841 kubectl apply -f svc.yaml
842 kubectl get svc
843 kubectl get endpoints
844 clear
845 kubectl get api-resources
846 kubectl get apiresourcees
847 kubectl get apiresources
848* kubectl get apiresource
849 kubectl get api-versions
850 kubectl get apis-versions
851 history |grep resources
852 kubectl api-resources
853 kubectl explain namespace
854 clear
855 kubectl get pods
856 kubectl run oreilly --image=redis
857 kubectl run oreilly --image=nginx
858 kubectl create namespace editor
859 kubectl run oreilly --image=nginx --namespace editor
860 kubectl get pods
861 kubectl get pods --namespace editor
862 kubectl get pods -v 9 --namespace editor
863 kubectl get pods -v 9
864 clear
865 kubectl get pods --all-namespaces
866 minkube ssh
867 minikube ssh
868 clear
869 kubectl get deployments
870 kubectl delete deployments frontend redis-master redis-replica
871 kubectl get pods --all-namespaces
872 kubectl get pods
873 kubectl create quota
874 kubectl create quota --help
875 clear
876 kubectl create quota foo --hard=pods=2 --namespace editor
877 kubectl get resourcequota
878 kubectl get resourcequota --namespace editor
879 kubectl create deployment foobar --image=redis --replicas 4 --namespace editor
880 kubectl get deployment -n editor
881 kubectl get deployment -n editor
882 kubectl get pods -n editor
883 kubectl get rs -n editor
884 kubectl get pods -n editor
885 kubectl get events -n editor
886 kubectl get rs -n editor
887 kubectl describe rs foobar-7d7559c64c -n editor
888 kubectl edit resourcequota foo
889 kubectl edit resourcequota foobar
890 kubectl edit resourcequota foo -n editor
891 kubectl get pods -n editor -w
892 kubectl get pods -n editor
893 kubectl get rs -n editor
894 kubectl get resourcequota -n editor
895 kubectl get pods -n editor -w
896 kubectl get events -n editor
897 kubectl get pods -n editor
898 kubectl get pods -n editor
899 kubectl get resourcequota -n editor
900 kubectl get ns
901 kubectl delete ns editor
902 ls -l
903 mkdir app
904 mkdir apptest
905 cd apptest
906 ls -l
907 ls -l
908 kubectl get pods
909 kubectl create deployment foo --image=redis -o yaml > d.yaml
910 kubectl get deployment
911 kubectl expose deployment foo --port 6379 -o yaml > svc.yaml
912 kubectl create ns alice -o yaml > ns.yaml
913 kubectl create quota foo --hard=pods=4 -o yaml > quota.yaml
914 ls -l
915 cat *.yaml
916 cat *.yaml > all-in-one.yaml
917 vi all-in-one.yaml
918 clear
919 cd ..
920 ls -l
921 kubectl get pods --all-namespaces
922 kubectl delete pods oreilly
923 clear
924 kubectl get pods --all-namespaces
925 clear
926 vi file.txt
927 cat file.txt
928 kubectl api-resources
929 clear
930 kubectl create secret generic password --from-literal=root=root
931 kubectl create configmap oreilly --from-file=file.txt
932 kubectl create configmap oreilly --from-file=file.txt -o yaml --dry-run
933 kubectl get cm
934 kubectl get secrets
935 kubectl get secrets password -o yaml
936 echo "cm9vdA==" |base64 -D
937 clear
938 kubectl get deployments
939 vi d.yaml
940 ls -l
941 more d.yaml
942 cp rs.yaml d.yaml
943 vi d.yaml
944 kubectl get cm
945 vi d.yaml
946 kubectl apply -f d.yaml
947 more d.yaml
948 kubectl get deployments
949 kubectl get rs
950 kubectl get pods
951 kubectl get cm
952 kubectl exec -ti oreilly-c9dfbcc7f-hpd7z -- ls -l /oreilly
953 kubectl exec -ti oreilly-c9dfbcc7f-hpd7z -- cat /oreilly/file.txt
954 more d.yaml
955 vi d.yaml
956 kubectl apply -f d.yaml
957 kubectl get deployments
958 kubectl get rs
959 kubectl get pods
960 kubectl exec -ti oreilly-5cbfc6bf54-vx67v -- ls -l
961 vi d.yaml
962 kubectl apply -f d.yaml
963 kubectl get pods
964 kubectl get pods
965 kubectl get pods
966 kubectl get pods
967 kubectl get pods
968 kubectl get pods
969 kubectl get pods
970 kubectl get pods
971 kubectl get pods
972 kubectl get pods
973 kubectl exec -ti oreilly-6dbff56bb6-vnn2t -- env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment