yum install MySQL-python
## Shortcuts to save time
export do="--dry-run=client -o yaml"
export now="--force --grace-period 0"
k delete pod x $now
alias kn='kubectl config set-context --current --namespace '
kn my-namespace
## JOIN KUBE CLUSTER ##
kubeadm token create --print-join-command
## Check Service CIDR ##
ssh cluster1-controlplane1
cat etc/kubernetes/manifests/kube-apiserver.yaml | grep range
## CNI Plugin is configured and where is its config file ##
find /etc/cni/net.d/
cat /etc/cni/net.d/10-weave.conflist
## Show Latest events ##
kubectl get events -A --sort-by=.metadata.creationTimestamp
### find pod running on cluster2-node1
k -n kube-system get pod -o wide | grep proxy
## killing pod on a node
crictl ps | grep kube-proxy
crictl stop e6fe93fbaec50
crictl rm e6fe93fbaec50
crictl ps | grep kube-proxy
## Write the names of all namespaced resources into file
k api-resources --namespaced -o name > /opt/course/16/resources.txt
## Check which namspace has more role (count )
k -n <namespacename> get role --no-headers | wc -l
cat <<EOF | kubectl apply -f -
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: app-role
namespace: project-hamster
rules:
- apiGroups:
- ""
- apps
- autoscaling
- batch
- extensions
- policy
- rbac.authorization.k8s.io
resources:
- configmaps
- secrets
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
EOF
cat <<EOF | kubectl apply -f -
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: app-rolebinding
namespace: project-hamster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: app-role
subjects:
- namespace: webapps
kind: ServiceAccount
name: processor
EOF
aws eks describe-cluster \
--region us-east-1 \
--name my-cluster \
--query "cluster.status"
aws eks create-cluster --region us-east-1 --name my-cluster --kubernetes-version 1.22 \
--role-arn arn:aws:iam::73095:role/AmazonEKSClusterRole \
--resources-vpc-config subnetIds=subnet-0814938360f2fdf5b,subnet-040ad1e2b5ffe4775
root@kubernetes-master:/home/ubuntu# history
1 swapoff -a
2 exit
3 swapoff -
4 swapoff -a
5 rm -rf /swap.img
6 exit
7 sudo apt update
8 sudo apt install docker.io
9 sudo systemctl enable docker
10 sudo systemctl start docker
11 sudo systemctl enable docker
12 sudo apt install apt-transport-https curl
13 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
14 sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
15 sudo apt install kubeadm kubelet kubectl kubernetes-cni
16 sudo swapoff -a
17 vi /etc/fstab
18 sudo hostnamectl set-hostname kubernetes-master
19 sudo kubeadm init
20 mkdir -p $HOME/.kube
21 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
22 sudo chown $(id -u):$(id -g) $HOME/.kube/config
23 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
24 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/k8s-manifests/kube-flannel-rbac.yml
25 kubectl
26 kubectl get pods --all-namespaces
27 kubectl get nodes
28 kubectl get pods --all-namespaces
29 kubectl
30 sudo swapoff -a
31 kubectl get nodes
32 sudo -i
33 kubectl get nodes
34 ufw allow 6443/udp && ufw allow 6443/tcp
35 kubectl get nodes
36 sudo -i
37 strace -eopenat kubectl version
38 kubectl get nodes
39 kubectl
40 sudo dockerf ps
41 sudo docker ps
42 kubectl get src
43 reboot
44 kubectl get nodes
45 history
1 git add ↳ It lets you add changes from the working directory into the staging area 2 git commit ↳ It lets you save a snapshot of currently...