CKA Learning path 2

1. Control Plane The control plane is a collection of multiple components responsible for managing the cluster itself globally. Essentially, the control plane controls the cluster. Individual control plane components can run on any machine in the cluster, but usually are run on dedicated controller machines.

1 - K8S Component tools

Component tools 1. Etcd A distributed, reliable key-value store for the most critical data of a distributed system etcd default port: 2379 ./etcdctl set key1 value1 ./etcdctl get key1 Every information you see when you run the kubectl get command is from the Etcd Server. To list all keys stored by Kubernetes, run the command like this. Run inside the etcd-master POD. kubectl exec etcd-master -n kube-system etcdctl get / --prefix -keys-only 2....

Python Newbie 0

1. How to save lines to list in only one line def read_config(config): with open(config, 'r') as f: return list(map(lambda item: item.strip('\n'), f.readlines())) 2. How to get value from nested dictionary def safe_get(dct, keys): for key in keys.split("."): try: dct = dct[key] except: return None return dct 3. How to rewrite the file import json with open (filename, 'r+') as json_file: ... json_file.seek(0,0) json.dump(data, json_file) 4. How to eliminate duplicate values in list sth = list(set(sth)) 5....

April 6, 2021 277 words 2 min

Shell

pushd & popd default values eval parentheses 1. pushd & pop pushd command is used to save the current directory into a stack and move to a new directory. popd can be used to return back to the previous directory that is on top of the stack. pushd and popd work according to the “LIFO” (last in, first out) principle. To know the stack of directories use dirs and to clear entire stack use dirs -c....

Least Privilege for GKE cluster

1. Create a Service Account gcloud iam service-accounts create least-gke-test --project fcr-it # create a new role gcloud iam roles create least-role --quiet \ --project "fcr-it" \ --file "custom-role.yaml" 2. Grant a role on SA add roles/container.clusterAdmin on SA first permission “setIamPolicy” required gcloud projects add-iam-policy-binding fcr-it --member serviceAccount:"least-gke-test@fcr-it.iam.gserviceaccount.com" --role projects/fcr-it/roles/leastrole 3. Revoking access from SA then grant another one gcloud projects remove-iam-policy-binding fcr-it --member serviceAccount:"least-gke-test@fcr-it.iam.gserviceaccount.com" --role roles/container.clusterAdmin gcloud projects add-iam-policy-binding fcr-it --member serviceAccount:"least-gke-test@fcr-it....