Skip to content
Kubernetes Samples
Shell Other
  1. Shell 98.8%
  2. Other 1.2%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Kubernetes Samples

Kubernetes commands

kubectl cluster-info
kubectl get nodes
kubectl version
kubectl get deploy,rs,po,svc,ep
kubectl logs podName
kubectl explain pods
kubectl create -f fileName.yml
kubectl get pods --namespace=kube-system
kubectl logs name -c containerName
kubectl describe pods podName
kubectl get rc
kubectl edit rc nginx
kubectl delete rc nginx
kubectl run nginx --image=nginx:1.12.0 --replicas=2 --port=80
kubectl expose deployment nginx --port=80 --target-port=80
kubectl create deployment firstpod --image=nginx
kubectl replace -f nginxDeployment.yml
kubectl apply -f nginxDeployment.yml
kubectl set image deployment nginx nginx=nginx:1.13.1
kubectl get deployment try1 -o yaml --export > simpleapp.yml
kubectl get endpoints
kubectl create secret generic mypassword --from-file=secrets/myverysecurepassword.txt
kubectl create secret generic mypassword2 --from-literal=password=123456
echo "aGVsbG9Xb3JsZA==" | base64 --decode
kubectl create configmap example --from-file=configs/
kubectl edit configmap example
kubectl top node
kubectl top pod besteffort
kubectl apply -f
kubectl describe --namespace=kube-system pod kubernetes-dashboard-5bd6f767c7-mfxs
kubectl cluster-info
kubectl delete --all pods --namespace=monitoring

sudo kompose convert -f docker-compose.yml -o localregistry.yml
kubectl rollout history deployment try1
kubectl rollout history deployment try1 --revision=1 > one.out
kubectl rollout undo --dry-run=true deployment/try1
kubectl rollout undo deployment try1 --to-revision=1

kubectl get events

kubectl get clusterroles
kubectl get rolebindings

Handling pods

kubectl get pod -o wide


grep Cap /proc/1/status
capsh --decode=00000000a80425fb


kubectl create configmap colors \
 --from-literal=text=black \
 --from-file=./favorite \

kubectl exec -c simpleapp -it try1-795c77c768-5qj9q -- /bin/bash -c 'cat /etc/cars/car.trim'

      - image:
        - mountPath: /etc/cars
          name: car-vol
        - name: ilike
              name: colors
              key: favorite
        - configMapRef:
            name: colors


ps -elf |grep kube-proxy
journalctl -a | grep proxy
sudo iptables-save |grep secondapp

kubectl -n kube-system get pod

General spec:

apiVersion: Kubernetes API version
kind: object type
  spec metadata, i.e. namespace, name, labels and annotations
  the spec of Kubernetes object

Certified Kubernetes Application Developer

  • check readiness
wget -O
chmod 755
./ LFD420
./ --install LFD420
  • add scripts
 wget \
--user=XXX --password=XXX
tar -xvf LFD259 V2019-03-11 SOLUTIONS.tar.bz2
  • update install step:
sudo apt-get update
sudo apt-get install -y kubernetes-cni=0.6.0-00
sudo apt-get install -y kubeadm=1.13.1-00 kubelet=1.13.1-00 kubectl=1.13.1-00

Processes within a node

  • kubelet receives requests to run the containers, manages any necassary resources and watches over them on the local node. It accepts pod specifications PodSpecs to configure the local node. It will also ensure the access or creation of storage, config maps or secrets if needed
  • kube-proxy creates and manages networkng rules to expose the container on the network

  • pod consists of one ore more containers which share an IP address, access to storage and namespace

  • ReplicaSet is a controller which deploys and restarts containers until the requested number of containers is running

  • parts of the master node: kube-apiserver, kube-scheduler, etcd, cloud-controller-manager

  • kube-apiserver is central to the operation of the cluster. All calls, both internal and external traffic are handled via this agent. All actions are accepted and validated by this agent, and it is the only connection to the etcd database

  • kube-scheduler uses an algorithm to determine which node will host a Pod of containers

  • etcd a b+tree key-value store to store the state of the cluster. Values are always appended to the end and not updated

You can’t perform that action at this time.