CKA Commands

Run Settings
LanguageBash
Language Version
Run Command
# Check logs for a given pod kubectl logs "$(kubectl get pods -o jsonpath='{.items[0].metadata.name}')" # Run commands within a given pod kubectl exec -it "$(kubectl get pods -o jsonpath='{.items[0].metadata.name}')" -- nginx -v #
#!/bin/bash # Get the Docker gpg key: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Add the Docker repository: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" # Get the Kubernetes gpg key: curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - # Add the Kubernetes repository: cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF # Update packages and install Docker, kubelet, kubeadm, and kubectl: sudo apt-get update && sudo apt-get install -y docker-ce kubelet kubeadm kubectl && sudo apt-get dist-upgrade -y # Add the iptables rule to sysctl.conf: echo "net.bridge.bridge-nf-call-iptables=1" | sudo tee -a /etc/sysctl.conf # Enable iptables immediately: sudo sysctl -p # Initialize the cluster: sudo kubeadm init --pod-network-cidr=10.244.0.0/16 # Set up local kubeconfig: mkdir -p /home/cka-admin/.kube sudo -i -u cka-admin cp -i /etc/kubernetes/admin.conf /home/cka-admin/.kube/config sudo -i -u cka-admin chown $(id -u):$(id -g) /home/cka-admin/.kube/config # Apply Flannel CNI network overlay: kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
#!/bin/bash # Get the Docker gpg key: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Add the Docker repository: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" # Get the Kubernetes gpg key: curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - # Add the Kubernetes repository: cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF # Update packages and install Docker, kubelet, kubeadm, and kubectl: sudo apt-get update && sudo apt-get install -y docker-ce kubelet kubeadm kubectl && sudo apt-get dist-upgrade -y # Add the iptables rule to sysctl.conf: echo "net.bridge.bridge-nf-call-iptables=1" | sudo tee -a /etc/sysctl.conf # Enable iptables immediately: sudo sysctl -p # Apply Flannel CNI network overlay: kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Editor Settings
Theme
Key bindings
Full width
Lines