Skip to content

Instantly share code, notes, and snippets.

@sameo
Last active March 24, 2017 18:35
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 sameo/7f82f2f565e34f639d15dd9623960d23 to your computer and use it in GitHub Desktop.
Save sameo/7f82f2f565e34f639d15dd9623960d23 to your computer and use it in GitHub Desktop.

Create an nginx pod:

kubectl run nginx --image=nginx --port=80 --replicas=3
kubectl expose deployment nginx --port=80 
kubectl run busybox-fail --rm -ti --image=busybox /bin/sh
kubectl run busybox --image=busybox --command -- sleep 600
kubectl expose deployment my-nginx --port=80 --type=NodePort
kubectl get svc
kubectl describe service my-nginx

Delete a pod:

kubectl delete deployment nginx
kubectl delete pods -n kube-system kube-dns-3913472980-lgsvz

Logs from a pod

kubectl logs my-pod
kubectl logs -n kube-system kube-dns-3913472980-224k5 sidecar

Describe a pod

kubectl describe pod kube-dns-3913472980-4ttz3 --namespace=kube-system

Launch a network add-on

From: https://kubernetes.io/docs/admin/addons/

kubectl apply -f https://raw.githubusercontent.com/projectcalico/canal/master/k8s-install/kubeadm/canal.yaml

CRI-O logs

journalctl -u ocid -n 1000 --no-pager
journalctl -u ocid --since "2017-03-15 14:15:00"

Inspect a docker image:

docker inspect gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment