I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot of time with integrating Kubernetes in both Cloud environment as well as in on-premise (Elastic Kubernetes Service in AWS, AKS, GKE, Kops and Rancher - RKE, K3S, kubeadm). I have dealt with ELK stack (Elasticsearch, Logshash and Kibana) to a complex infrastructure monitoring. I’m dealing with dockerized Grafana and Prometheus setup in Kubernetes. Postgraduate student in a field of Optoelectronics (Free Space Optics communications). Engineer graduated in field of Info-electronics with five years of experience on System Administration and application administration as well as other related fields.
Jan Toth
How to list all groups and members in GCP organization
gcloud identity groups search --labels="cloudidentity.googleapis.com/groups.discussion_forum" --organization="111111111111" --page-size=3000 --format=json > groups.json for i in $(cat groups.
Read MoreAnsible Bitbucket
Links: 202410042010 --- # ......................................................................... # 1. Creating Bitbucket project for GCP Solution Project # .
Read MoreHow to create resource in Bitbucket via curl and Ansible
There are some situation when one can have credentials to some web page that does not have API properly exposed and TOKEN can not be used.
Read MoreCheck permissions for users and service account in GCP via gcloud
[arch:tmp ] gcloud projects get-iam-policy <project-name> \ --flatten="bindings[].members" \ --format='table(bindings.role)' \ --filter="bindings.
Read MoreHow to process raw html page via pup and jq to get ratings
The friend of mine wrote Bash script that parses raw HTML page using grep and loops to find images with rating higher than some number.
Read MoreHow to assemble project name based on yaml content using jq
If you have multiple files without proper names, you can generate project names based on the values in the YAML files.
Read MoreHow to conditionally add key value to Terraform map
This code will conditionally add or ommit netapp-cleaner block based on prefix local variable.
Read MoreHow to use regexp with jq
How to use regexp within jq when selecting documents PROJECT_NAMES="one|two|there" REGEXP_SOL_PROJ="^prefix-${ENVIRONMENT}-(${PROJECT_NAMES}).
Read MoreHow to pass --url-query to curl
This is a nice way how to multiline query parameters when using curl
Read MoreHow to deduplicate elements using jq
####### Input file some: awesome: members: - green - yellow - blue - red - green ####### Deduplication
Read MoreHow to select entries with sso_team_id using jq
Goal How to choose only records that have sso_team_id key defined?
Read MoreHow to GCP Private Service Connect PSC between two VPCs within different projects
Create 2 new GCP Projects in Free Tier Account gcloud projects create consumer-cmd --name="consumer-cmd" --enable-cloud-apis gcloud projects create producer-cmd --name="producer-cmd" --enable-cloud-apis # verify creation [arch:devopsinuse main()U] gcloud projects list PROJECT_ID NAME PROJECT_NUMBER .
Read MoreHow to detect duplicates using jq
yq -o=json eval data/aaa/bbb.yaml | jq '.ldap.ldap.members | group_by(.) | map(select(length>1) | .
Read MoreGCP PCA certification notes
Using multiple gcloud configurations/profile v ~/.config/gcloud/configurations/config_profile1 ... [core] custom_ca_certs_file = /Users/AAAA/Documents/proxyCA.
Read MoreUseful Vim Commands
Find all yaml files that satisfy pattern, open them in Vim and delete each line that has some string in it v organization/*/*/*/*/XZY*.
Read MoreMy Tmux setup
I have been using tmux for quite a while now. Despite the fact that, I sometimes felt weird because of all the other colleagues use VSCODE I never thought of coming back to one of these fameous IDEs.
Read MoreAzure az behind corporate proxy
Url that solves that problem https://docs.microsoft.com/en-us/cli/azure/use-cli-effectively?tabs=bash%2Cbash2 # https://docs.microsoft.com/en-us/cli/azure/use-cli-effectively?tabs=bash%2Cbash2 cat ~/Documents/proxyCA.crt >> /usr/local/Cellar/azure-cli/2.
Read MoreOneliner to compare software versions
export _tags=$(git tag --list | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') export _current=$(curl -s https://api.
Read MoreHow to use Google AppScript for docs templating at presonal Google Drive
I have recently had a requirement to create write quite a bit of letters.
Read MoreHow to replace text in lots of file via sed and find
I have recently decided to change the way how my code blocks look like at this blog.
Read MoreHow to use jq as PRO
curl -s \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.
Read MoreDrone CICD on Rancher Desktop MAC Kubernetes
Drone CICD at Rancher on Desktop at Mac Setup /etc/hosts file vim /etc/hosts .
Read MoreCKS testing mock
kube-apiserver manifest with PodSecurityPolicy, ImagePolicyWebhook, Auditing cat /etc/kubernetes/manifests/kube-apiserver.yaml apiVersion: v1 kind: Pod metadata: annotations: kubeadm.
Read MoreHow to ommit optional block in terrafrom resource based on input variable
The goal is to create azurerm_virtual_hub_connection which might or might not have an optional block called static_vnet_route section under routing {} block.
Read MoreCKS Istio notes
Work in progress on Istio Do not forget to restart CoreDNS after you install Callico since there was already crio basic CNI activated!
Read MoreHwo to change wrong author within last git commit
git commit --amend --author="Surname Name CCCCC <name.surname@external.company.com>"
Read MoreCKS Kubernetes CNI
Container infor passed by kubelet to stdin of CNI bash plugin CNI_CONTAINERID=b552f9.
Read MorePodman commands
Assuming there are more containers running in a single Podman pod some backend service 9011 phpMyAmdin at port 80 (interpreted by Apache2 inside container) podman create --restart=always --pod=some-pod-name --name=phpmyadmin -e PMA_ABSOLUTE_URI="https://some.
Read MoreHow to transfer gitlab calculated variable into trigger section
One has to used artifacts section combined with reports child keyword and save a variable with its value to build.
Read MoreCKS run kubernetes with cri-o
How to run Kubernetes with cri-o https://computingforgeeks.com/install-cri-o-container-runtime-on-ubuntu-linux/ OS=xUbuntu_20.04 CRIO_VERSION=1.23 echo "deb https://download.
Read MoreCKS simulator
k get pods -A -o jsonpath='{range .items[*]}{.spec.nodeName}{"\t\t\t\t"}{.spec.containers[*].image}{"\t"}{"\n"}{end}' | sort | grep cluster1-worker1
Read MoreCKS Reduce Attack Surface
Overview only purpose (remove unneceassary services) node recycling (should be ephemeral, created from images) ubuntu, centos systemctl list-units | grep <service-name> systemctl list-units --type=service | grep <service-name> systemctl list-units --type=service --state=running | grep <service-name>
Read MoreCKS Kernel Hardening Tools
Requirements for Apparmor container runtime needs to support Apparmor Apparmor needs to be installed on every node Apparmor profiles need to be available on every node Apparmor profiles are specified per container (done via annotations) not per pod!
Read MoreCKS Audit logging via kube-api server
Important Kubernetes request stages What events should be recorded Audit log from Mushad course
Read MoreCKS Immutability of containers at runtime
advanced deployment methods easy rollback more reliability better security (on container level) Interesting example of how ‘‘startupProbe’’ can be used to make container a bit more secure root@cks-master:~# cat immutable.
Read MoreCKS behavioral analytics falco
Explore strace root@scw-k8s:~# strace -cw ls / bin etc initrd.
Read MoreCKS Secure supply chain - ImagePolicyWebhook
If you want to pull from a docker registry you need to docker login first.
Read MoreCKS Trivy and Clair - Vulnerability Scanner for Containers and other Artifacts
There are Clair and Trivy trivy (run one command - very convinient)
Read MoreCKS Kubesec - Security risk analysis for Kubernetes resources
Static Analysis manual approach kubesec OPA Conftest Notes can be incorporated in CI/CD system looks at source code and text files check against rules enforce rules e.
Read MoreCKS Image Footprint
run specific version do not run as root not shell read only filesystem This would be an ideal example of Dockerfile
Read MoreOPA - Gatekeeper
OPA is not Kubenretes specific general purpose policy engine An admission controller is a piece of code that intercepts requests to the Kubernetes API server prior to persistence of the object, but after the request is authenticated and authorized.
Read MoreCKS OS Level Security Domains
Define privilege and access control for Pod/Container userID and GroupID run privileged or unprivileged Linux Capabilities Run a simple container and check user and group root@scw-k8s:~# k run pod --image=busybox --command -oyaml --dry-run=client -- sh -c 'sleep 1d' > bb.
Read MoreCKS container runtimes
# go inside of a container and call root@scw-k8s:~# k exec -it pod -- sh / # uname -r 5.
Read MoreCKS secrets
k create secret generic secret1 --from-literal=jano=jano k create secret generic
Read MoreCKS upgrade kubernetes
major minor patch 1 . 24 . 0 Upgrade Master Node procedure drain and cordon (make it unschedulable) node kubeadm kube-apiserver controller-manager scheduler then:
Read MoreCKS Restrict API server
There is an flag when starting kube-aoiserver called: kube-apiserver --anonymous-auth=true|false The default value for this option is true because some liveness and readiness probes needs it.
Read MoreJenkins seed
sudo nerdctl run --name jenkins -p 8080:8080 -v $PWD/initial.xml:/var/jenkins_home/jobs/seed/config.xml -v $PWD/controller-configuration-jobDSL-orig.
Read MoreCKS serviceaccount
SesrviceAccount (SA) are namespaces SA “default” in every namespace automatically mounted to a pod can be used to talk to Kubernetes API k create sa accessor k run accessor --image=nginx:alpine -o yaml --dry-run=client > accessor.
Read MoreKubernetes RBAC
There are namespaced and non namespaced resources in Kubernetes. Role (namespaced) -> RoleBinding ClusterRole (non namespaced) -> ClusterRoleBinding Be extra careful with ClusterRole and ClusterRoleBinding because these are not only assigned to currently existing namespaces but also to namespaces created in future.
Read MoreVerify binaries
One has to compare the binary version which is currently running at the Kubernetes master and later on find out the PID of kubelet process.
Read MoreProtect Kubernetes node metadata
Deny all traffic to google’s metadata server Study this rule carefully - it takes time to understand it :)
Read MoreKubernetes dashboard
Kubectl proxy creates a proxy server between localhost and the Kubernetes API Server uses connection as configured in the kubeconfig Run kubectl proxy command at your master node cks-master Kubectl port-forward Install kubenretes dashboard kubectl apply -f https://raw.
Read MoreKubernetes Ingress
Services in Kubernetes ClusterIP (points to a pod via labels selectors) NodePort (in addition a port is exported at each node) Loadbalancer (in addition creates LB at cloud provider) Deploy Nginx ingress controller # Install NGINX Ingress kubectl apply -f https://raw.
Read MoreHow to count numbers from pdf
user@machine tax2021 % for i in $(ls *.pdf); do \ pdftotext $i - | grep -E '^\+.
Read MoreMy NVIM init file
" plugins" curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vimcall plug#begin("~/.config/nvim/plugged")" Plugin SenohlsearchctionPlug 'ryanoasis/vim-devicons'Plug 'morhetz/gruvbox'Plug 'neoclide/coc.
Read MoreMy zshrc file
HISTFILE=~/.zsh_history HISTSIZE=10000 SAVEHIST=10000 setopt appendhistory # source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.
Read MoreKubernetes network policies
Here is an example of network policies k taint node scw-k8s-cks node-role.
Read MoreCKS setup Scaleway kubernetes cluster at Ubuntu 18.04
Create SSH key pair to be used for Kubernetes master and node machine
Read MoreLinux Namespaces
Namespaces isolates processess restricts what processes can see. PID namespace:
Read MoreKubernetes SSL certificates
There are many SSL certificates used by different Kubenretes components.
Read MoreHow to preview images in Ranger file manager with iTerm and Tmux
I have been avare of ranger as a file system browser for quite some time.
Read MoreTanicka a jej vyroky
Sa hnevam, ze mi dal jednu piskotku, mi mal dat vela ten kocur mi zjedol vsetky piskoty do vecera budem stastna (Tato mi dal piskotku)
Read MoreHow to open support ticket at Udemy
Please use link below: https://support.udemy.com/hc/en-us/requests/new https://www.viewmyforms.com/account mail/L…tax
Read MoreGit clone with private key
git clone git@github.com:autocloudmaniacs/red-queen-appl.git --config core.sshCommand="ssh -i ~/.ssh/erste" Create ~/.ssh/config file
Read MoreAnsible debug variables
- name: xyz vars: msg: | Module Variables ("vars"): -------------------------------- {{ vars | to_nice_json }} Environment Variables ("environment"): -------------------------------- {{ environment | to_nice_json }} GROUP NAMES Variables ("group_names"): -------------------------------- {{ group_names | to_nice_json }} GROUPS Variables ("groups"): -------------------------------- {{ groups | to_nice_json }} HOST Variables ("hostvars"): -------------------------------- {{ hostvars | to_nice_json }} debug: msg: "{{ msg.
Read MoreDestroy terrafrom project -backend-config
export AWS_SECRET_ACCESS_KEY="..." export AWS_ACCESS_KEY_ID="..." export AWS_DEFAULT_REGION="us-west-2" export TF_VAR_project_name=hruska cd terraform/k3s terraform init -backend-config="path=/home/jantoth/Documents/sbx/ml/data/hruska/terraform.
Read Moredocker ansible
export CI_REGISTRY=docker.io docker login -u "devopsinuse" -p "..." $CI_REGISTRY docker push devopsinuse/ansible-ml:v2.
Read MoreInstall Raspberry Pi OS (Raspberry Pi 3)
https://www.raspberrypi.org/documentation/installation/installing-images/linux.md Check SD card presence at your laptop lsblk -p NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT /dev/sda 8:0 0 1G 0 disk /var/lib/kubelet/pods/d6fe24f2-3dc7-4291-90f5-8c7dbb4e8382/volu /dev/mmcblk0 179:0 0 14.
Read MoreInstall Ubuntu 20.04 (Raspberry Pi 3)
Install Ubuntu at Raspberry Pi 3 xz --decompress --stdout ~/Downloads/ubuntu-20.04.1-preinstalled-server-arm64+raspi.img.xz | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync status=progress Ubuntu at Raspberry Pi WIFI setup vim /run/media/jantoth/system-boot/network-config .
Read MoreInstall Ubuntu 20.04 (Raspberry Pi 4 8GB)
1. Install Ubuntu at Raspberry Pi 3 xz --decompress --stdout ~/Downloads/ubuntu-20.
Read MoreIPSec Tunnel
# LAPTOP cat /etc/ipsec.conf config setup conn laptop authby=secret pfs=yes auto=start keyingtries=3 dpddelay=30 dpdtimeout=120 dpdaction=clear ikelifetime=8h ikev2=no keylife=1h #phase2alg=aes128-sha1;modp1024 #ike=aes128-sha1;modp1024 type=tunnel left=%defaultroute leftsubnet=192.
Read MoreList VirtualBox bridge family interfaces names
List VirtualBox bridge family interfaces names VBoxManage list bridgedifs
Read MoreNvidia Jetson installation
Download SD card image https://developer.download.nvidia.com/assets/embedded/downloads/jetson-nano-4gb-jp441-sd-card-image/jetson-nano-4gb-jp441-sd-card-image.zip Create SD card for NVIDIA Jetson Nano unzip -p ~/Downloads/jetson-nano-4gb-jp441-sd-card-image.
Read MoreOpenVPN (Site to Site)
‘‘Setup’’ routing table at EC2 ubuntu@ip-172-31-49-24:/etc/openvpn/server$ ip r default via 172.
Read MoreApache Spark
helm3 install spark \ --set master.webPort=8081 bitnami/spark NAME: spark LAST DEPLOYED: Mon Sep 7 15:25:26 2020 NAMESPACE: default STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: 1.
Read MoreAWS EKS aws-auth configmap mapUsers
Take a backup of ‘‘aws-auth’’ config map in ‘‘kube-system’’ namespace kubectl get cm aws-auth -n kube-system -o yaml > aws-auth.
Read MoreAWS EKS ML
aws eks --region us-west-2 update-kubeconfig --name ml-eks --profile jan-toth-ml kubectl apply -f https://raw.
Read MoreCreate more configMaps via Go templating
{{ range $path, $_ := .Files.Glob "dashboards/*.json" }} {{- $dashboardName := trimSuffix ".
Read MoreCreate Pod on the fly
kubectl run -i --tty busybox --image=gcr.io/kubernetes-e2e-test-images/dnsutils:1.3 --restart=Never -- sh kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
Read MoreDelete AWS ENI via cmd
echo $t error waiting for EKS Node Group (eks-mlflow:eks-mlflow-cpu-ng) deletion: Ec2SecurityGroupDeletionFailure: DependencyViolation - resource has a dependent object.
Read MoreDrain node from K3S
Deleted node from K8s kubectl drain k3s-ubuntu-18-04 --ignore-daemonsets --delete-local-data kubectl delete node k3s-ubuntu-18-04
Read MoreForce delete pods
kubectl delete pod drillcluster1-drillbit-0 zk-0 --grace-period=0 --force kubectl patch pod drillcluster1-drillbit-0 zk-0 -p '{"metadata":{"finalizers":null}}'
Read MoreGrafana dashboard loading
helm repo add grafana https://grafana.github.io/helm-charts helm template \ --show-only templates/configmap-dashboard-provider.yaml \ --show-only templates/deployment.
Read MoreGrafana dashboard via curl
do not forget to add “id: null” encapsulate to {“dashboard”: …} curl -L \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -X POST \ -uadmin \ --data @/tmp/path/dashboards/dashboard.
Read MoreInstall K3S with Rancher UI
Adjust your /etc/hosts file # Adjust your /etc/hosts file cat /etc/hosts .
Read MoreK3S with Nvidia GPU
mkdir $HOME/.kube/ curl -sfL https://get.k3s.io | sh -s - --docker --write-kubeconfig-mode 644 --write-kubeconfig $HOME/.
Read MoreLogin to Rancher
NAME="rancher.web.ui" RANCHER_URL="https://$NAME:10443" APITOKEN=$(curl -sk "${RANCHER_URL}/v3-public/localProviders/local?action=login" \ -H "content-type: application/json" \ --data-binary "{\"username\":\"admin\",\"password\":\"admin\"}" 2>/dev/null | jq -r .
Read MorePostgreSQL RDS AWS
psql -h mldb-postgres.cgpyiy4kedtv.us-west-2.rds.amazonaws.com -U postgres -d mldb kubectl exec pod-demo-0 -it -- \ sh -c "echo 'DROP DATABASE fgh;' | PGPASSWORD=$PGPASSWORD /usr/bin/psql -h 127.
Read MoreDelete database entries via bash alias
alias delprn='psql "host=127.0.0.1 port=5432 sslmode=disable user=rednetwork password=password" <<< "delete from port_range_networks where id between 1 and 10000;"'
Read Moreflask commands
with app.app_context(): # needed to make CLI commands work @app.cli.command("reset") def reset_db(): """Drops and Creates fresh database""" db.
Read MoreConcat mp4 file with ffmpeg
**Concatenated'' video files (e.g. *.mp4) specified in *.txt file ‘‘created’’ on the file
Read MoreDetermine the length of mp4 file
for i in file1.mp4 file2.mp4 file3.mp4 ; do t=$(ffmpeg -i $i 2>&1 | grep Duration | awk '{print $2}' | tr -d ,); echo " $t: $i"; done
Read MoreHow to cut a portion of video
ffmpeg \ -t 4:12 \ -i <input-file>.mp4 \ -ss 4:07 \ <output-file>.
Read Morekickstart Centos 8
**Centos 8 ISO location'' wget http://merlin.fit.vutbr.cz/mirrors/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-dvd1.iso **Run this command''
Read MoreConnecting to PostgreSQL via Cloud SQL Proxy
**Download a postgresql cloud sql proxy binary'' https://cloud.google.com/sql/docs/postgres/connect-admin-proxy?authuser=1&_ga=2.119700096.-903944264.1624478760 wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy chmod +x cloud_sql_proxy **Open this tunnel in one terminal window''
Read MoreGoogle cloud
**Terraform in my wadzpay-dev'' GOOGLE_APPLICATION_CREDENTIALS=/home/jantoth/.google-cloud-keys/wadzpay-dev-cdb0bf1613d2.json gcloud auth list gcloud config set account jan.
Read MoreGoogle cloud pipeline example
**cloudbuild.yaml'' steps: - id: 'Get wadzpay docker image tag from build.
Read MoreAccess Google's metadata
Access Google’s metadata curl http://metadata.google.internal/computeMetadata/v1/instance/id -H "Metadata-Flavor: Google"
Read MoreAll syscalls
**Learn about syscalls and seccomp'' # Each and every syscall explained grep -w 35 /usr/include/asm/unistd_64.
Read MoreAuthentication forms
**Authentication'' against KUBE-API server --basic-auth-file=/path/to/some.csv and use this flag for ‘‘kubeapi-server’’ configuration (not recommended)
Read MoreBackup ETCD
export ETCDCTL_API=3 etcdctl snapshot save /opt/snapshot-pre-boot.db --cert=/etc/kubernetes/pki/etcd/server.crt --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key
Read Moreckad study materials
Make sure you check out these tips and tricks from other students who have cleared the exam:
Read MoreCKS - Mock test 1
controlplane $ cat 1.yaml apiVersion: v1 kind: Pod metadata: labels: run: nginx name: frontend-site namespace: omni annotations: container.
Read MoreCKS Mock test 2 - Q1
**1. A pod called redis-backend has been created in the prod-x12cs namespace.
Read MoreCKS Mock test 2 - Q2
**A few pods have been deployed in the apps-xyz namespace. There is a pod called redis-backend which serves as the backend for the apps app1 and app2.
Read MoreCKS Mock test 2 - Q3
**3. A pod has been created in the gamma namespace using a service account called cluster-view.
Read MoreCKS Mock test 2 - Q4
**4. A pod in the sahara namespace has generated alerts that a shell was opened inside the container.
Read MoreContainer Runtimes
docker run --runtime kata -d nginx docker run --runtime runsc -d nginx ~ [img[container-runtime.
Read MoreCreate John user in Kuberentes
kubectl create role developer --verb=create,list,get,update,delete --resource pods --namespace development kubectl create rolebinding john-role-binding --role developer --user john --namespace development apiVersion: certificates.
Read MoreDaemonSet
controlplane $ cat ds.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: elasticsearch namespace: kube-system labels: app: elasticsearch spec: selector: matchLabels: name: elasticsearch template: metadata: labels: name: elasticsearch spec: tolerations: # this toleration is to have the daemonset runnable on master nodes # remove it if your masters can't run pods - key: node-role.
Read MoreDeployments
kubectl set image deployment/frontend *=kodekloud/webapp-color:v2 --dry-run=server --record controlplane $ kubectl rollout history deployment frontend deployment.
Read MoreDocker layers
cat Dockerfile FROM ubuntu ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update -y && apt-get install golang-go -y COPY app.
Read MoreGame of Pods - App Gallery
for i in $(ls *.yaml); do echo filename: $i;echo "---" ;cat $i; done filename: ingress.
Read MoreGame of Pods - Redis cluster
for i in {1..6}; do ssh node01 mkdir /redis0${i}; done ssh node01 ls /redis* for i in $(ls *.
Read MoreGame of Pods - Tyro
kubectl config set-context --current --cluster=kubernetes --namespace=development --user=drogo kubectl config use-context developer --cluster=kubernetes --namespace=development --user=drogo kubectl config current-context cat ~/.
Read MoreGame of Pods - Voting app
for i in $(ls *.yaml); do echo filename: $i;echo "---" ;cat $i; done filename: db-depl.
Read MoreImmutable infrastructure (readOnlyRootFilesystem,privileged)
Set ‘‘UID’’ and ‘‘GID’’ within ‘‘securityContext’’ for pod and verify results (‘‘runAsUser’’ and ‘‘runAsGroup’')
Read MoreJobs and CronJobs
Job # Create job skeleton kubectl create job throw-dice-job --image=kodekloud/throw-dice --dry-run=client -o yaml > job.
Read Morekubectl commands
kubectl sort by kubectl get pods -A --sort-by=.metadata.name NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-854c77959c-m972h 1/1 Running 0 5h38m kube-system helm-install-traefik-hx29s 0/1 Completed 0 5h38m kube-system local-path-provisioner-7c458769fb-s2xww 1/1 Running 3 5h38m kube-system metrics-server-86cbb8457f-ndxlz 1/1 Running 0 5h38m default nginx 1/1 Running 0 3m11s kube-system svclb-traefik-gb64t 2/2 Running 0 5h38m kube-system traefik-6f9cbd9bd4-xlslc 1/1 Running 0 5h38m Custom columns kubectl get pod -A -o=custom-columns="YZZ:.
Read MoreKubernetes docker-registry like secret
**Create a Secret by providing credentials on the command line''
Read MoreLightening Lab - CKA
Some other notes kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE alpha-claim Bound alpha-pv 1Gi RWO slow 4s controlplane $ kubectl get pods NAME READY STATUS RESTARTS AGE alpha-mysql-74ffffd5df-k55wj 0/1 ContainerCreating 0 9s controlplane $ watch kubectl get pods controlplane $ controlplane $ controlplane $ controlplane $ controlplane $ controlplane $ watch kubectl get pods^C controlplane $ cat 5.
Read MoreLightening lab 1
apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: nginx-deploy name: nginx-deploy spec: replicas: 4 selector: matchLabels: app: nginx-deploy strategy: {} template: metadata: creationTimestamp: null labels: app: nginx-deploy spec: containers: - image: nginx:1.
Read MoreLightening lab 2
**Commands'': controlplane $ for i in $(ls *.yaml); do echo filename: $i;echo "---" ;cat $i; done filename: 2.
Read MoreLinux Capabilities
You cannot change system time even though you are not using APPARMOR or SECCOMP.
Read MoreMetric server
wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml sed -iE 's/^(.*--kubelet-use-node-status-port)/\1 \n - --kubelet-insecure-tls/' components.yaml kubectl create -f components.
Read MoreMock exam 2
controlplane $ for i in $(ls *.yaml); do echo filename: $i;echo "---" ;cat $i; done filename: 1svc.
Read MoreMOCK EXAM 2 CKA
kubectl run dns -it --image=busybox:1.28 --restart Never -- nslookup resolver-service.default.svc > CKA/nginx.
Read MoreMulti-Container Pods
apiVersion: v1 kind: Pod metadata: labels: name: app name: app namespace: elastic-stack spec: containers: - image: kodekloud/event-simulator name: app volumeMounts: - mountPath: /log name: log-volume - mountPath: /var/run/secrets/kubernetes.
Read MorenetworkPolicy
# allow incoming traffic to pod "run: np-test-1" to port 80 from everywhere apiVersion: networking.
Read MoreNode Affinity
Match node ‘‘label’’ app: blue strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: creationTimestamp: null labels: app: blue spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: color operator: In values: - blue containers: - image: nginx imagePullPolicy: Always name: nginx resources: {} terminationMessagePath: /dev/termination-log terminationMessagePolicy: File
Read MorePodSecurityPolicy
**Setup API server to allow PodSecurityPolicy Admission controller'' cat /etc/kubernetes/manifests/kube-apiserver.yaml apiVersion: v1 kind: Pod metadata: annotations: kubeadm.
Read MoreReadOnlyRootFilesystem
root@cks-master:~# k delete po immutable --grace-period 0 --force root@cks-master:~# k create -f immutable.
Read MoreResourceQuota
kubectl create quota myrq --hard=cpu=1,memory=1G,pods=2 -o yaml --dry-run=client apiVersion: v1 kind: ResourceQuota metadata: creationTimestamp: null name: myrq spec: hard: cpu: "1" memory: 1G pods: "2" status: {}
Read MoreRuntimeClass GAdvisor and Kata containers
**Prepare runtimeClass yaml specification'' k get runtimeclasses.node.k8s.io -A NAME HANDLER AGE gvisor runsc 2m58s kata-containers kata-runtime 2m57s vim runtimeclass.
Read MoreSecuring docker daemon
**Best practices'' export DOCKER_HOST=192.1681.2 <---- insecure /var/run/docker.sock < --- secure export DOCKER_TLS=true
Read MoreServiceAccount token from inside of pod
curl https://kubernetes -k -H "Authorization: Bearer $(cat /run/secrets/kubernetes.io/serviceaccount/token)"
Read Moretaint and tolerations
taints are set to ‘‘Nodes’’ toleration are set to ‘‘PODS’’ taints: kubectl taint nodes arch app=blue:NoSchedule node/arch tainted Other ‘‘taint’’ options:
Read MoreVolumes
at file.yaml apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: webapp name: webapp spec: volumes: - name: my-volume hostPath: path: /var/log/webapp containers: - image: kodekloud/event-simulator name: webapp resources: {} volumeMounts: - name: my-volume mountPath: /log dnsPolicy: ClusterFirst restartPolicy: Always status: {} Storage classes controlplane $ for i in `ls *.
Read MoreCopy store.php to websupport linuxinuse.com via sftp
scp -o PubkeyAuthentication=no store.php linuxinuse.com@linuxinuse.com:web/tw/ sftp -o HostKeyAlgorithms=ssh-rsa devopsinuse.com@devopsinuse.com
Read MoreGenerate SSH kyes for websupport gitlab
ssh-keygen -t rsa -b 4096 -f ~/.ssh/websupport-ssh -C "toth.janci@gmail.com" git remote add sshorigin git@gitlab.
Read MoreRemove tiddlywiki backup files from websupport
sftp linuxinuse.com@linuxinuse.com << EOF rm web/tw/index.20200430.153755.html exit EOF Take an advantage of ‘‘regular expressions’’
Read MoreSSH config examples
vim ~/.ssh/config ... Host git-codecommit.*.amazonaws.com User A...SVRJMWFPY IdentityFile ~/.ssh/kops-aws Host 1.
Read MoreSSH tunnel to Samba server via hron
How to ‘‘SSH’’ to river eval `ssh-agent` # add SSH key to keering ssh-add ~/.
Read MoreGo apply and applyProcess hands on 11
package main import ( "net/http" "html/template" ) var tpl *template.Template func init() { tpl = template.
Read MoreGo arrays <TITLE><TITLE> slices
package main import ( "fmt" // "strconv" // "math" ) func arrays() { grade1 := 97 grade2 := 85 grade3 := 93 grades := [3]int{11,22,33} // [.
Read MoreGo concurency
// package main // import ( // "fmt" // // "strconv" // // "math" // // "reflect" // // "net/http" // // "log" // ) // // define interface // type Writer interface { // Write([]byte) (int, error) // } // type ConsoleWriter struct {} // func (cw ConsoleWriter) Write(data []byte) (int, error) { // n, err := fmt.
Read MoreGo constants
func constants() { // it is a constant because it should not change its value !
Read MoreGo create file on server
package main import ( "fmt" "html/template" "io/ioutil" "net/http" "os" "path/filepath" ) var tpl *template.
Read MoreGo explore ResponseWriter and Request
package main import ( "fmt" "html/template" "log" "net/http" "net/url" ) var tpl *template.
Read MoreGo funcMaps
package main import ( "os" // "io" "fmt" "log" "strings" "text/template" ) var tpl *template.
Read MoreGo functions
package main import ( "fmt" // "strconv" // "math" // "reflect" // "net/http" // "log" ) func sayMessage(msg string, idx int) { greetings := "Hello" fmt.
Read MoreGo HandlerFunc()
package main import ( "io" "net/http" ) func dogs(w http.ResponseWriter, r *http.
Read MoreGo HandlerFunc() review
package main import ( "html/template" "net/http" ) var tpl *template.Template func init() { tpl = template.
Read MoreGo http.FileServer()
import ( "io" "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("."))) http.
Read MoreGo http.NewServerMux()
package main import ( "io" "net/http" ) type pageDog int func (pd pageDog) ServeHTTP(w http.
Read MoreGo http.Redirect(...) http.StatusMovedPermanently 301
package main import ( "fmt" "net/http" ) // Redirects: // - StatusMultipleChoices = 300 // RFC 7231, 6.
Read MoreGo http.Redirect(...) http.StatusSeeOther 303
package main import ( "fmt" "html/template" "net/http" ) // Redirects: // - StatusMultipleChoices = 300 // RFC 7231, 6.
Read MoreGo http.Redirect(...) http.StatusTemporaryRedirect 307
package main import ( "fmt" "html/template" "net/http" ) // Redirects: // - StatusMultipleChoices = 300 // RFC 7231, 6.
Read MoreGo http.Redirect(...) set redirection manually with headers
package main import ( "fmt" "html/template" "net/http" ) // Redirects: // - StatusMultipleChoices = 300 // RFC 7231, 6.
Read MoreGo if else statements
package main import ( "fmt" // "strconv" // "math" // "reflect" ) func ifelsestatements() { statePopulation := make(map[string]int) statePopulation = map[string]int{ "California": 2341232, "Texas": 3341232, "Florida": 4341232, "New York": 5341232, "Illinois": 6341232, "Ohio": 7341232, } fmt.
Read MoreGo include template
package main import ( "os" // "time" "fmt" "log" // "math" "text/template" ) var tpl *template.
Read MoreGo interfaces
// package main // import ( // "fmt" // // "strconv" // // "math" // // "reflect" // // "net/http" // // "log" // ) // // define interface // type Writer interface { // Write([]byte) (int, error) // } // type ConsoleWriter struct {} // func (cw ConsoleWriter) Write(data []byte) (int, error) { // n, err := fmt.
Read MoreGo methods
package main import ( "fmt" // "strconv" // "math" // "reflect" // "net/http" // "log" ) type greeter struct { greeting string name string } func (g greeter) greet() { fmt.
Read MoreGo methods templates and composition
package main import ( "log" "os" "text/template" ) type person struct { Name string Age int } // Start -Let's define several methods for struct person func (p person) SomeProcessing() int { return 7 } func (p person) AgeDbl() int { return p.
Read MoreGo panic() recover() and defer()
package main import ( "fmt" // "strconv" // "math" // "reflect" "net/http" "log" ) func simplePanic() { a, b := 1, 0 ans := a/b fmt.
Read MoreGo pointers
package main import ( "fmt" // "strconv" // "math" // "reflect" // "net/http" // "log" ) func simple() { a := 42 // b will be a brand new variable with it's place in memory b := a fmt.
Read MoreGo primitives
// Primitives func primitives() { var n bool = true v := 1 == 1 x := 3 == 2 // signed int16 (-65 535, 65 535) var c int16 = 2 // unsigned int16 (0, 65 535) var f uint16 = 10 fmt.
Read MoreGo r.Body.Read()
package main import ( "net/http" "html/template" "log" ) var tpl *template.
Read MoreGo request.FormValue('x') with ExecuteTemplate(...)
package main import ( "net/http" "html/template" "log" ) var tpl *template.
Read MoreGo request.FormValue('xyz')
package main import ( "fmt" "io" "net/http" ) func main() { http.
Read MoreGo rune type
func arrays() { // !!! if declating string -> use double quotes "" s := "this is a string" b := []byte(s) fmt.
Read MoreGo serving files hands on 1
package main import ( "html/template" "io" "log" "net/http" ) func main() { http.
Read MoreGo serving files with StripPrefix() hands on
package main import ( "html/template" "log" "net/http" ) func main() { http.
Read MoreGo simple multiplexer by me
package main import ( "fmt" "log" "net" "bufio" "strings" ) func main() { li, err := net.
Read MoreGo simple mux
package main import ( "io" // "html/template" "log" "net/http" // "net/url" ) // var tpl *template.
Read MoreGo simple TCP hands on
package main import ( "bufio" "fmt" "log" "net" "time" "strings" ) func main() { li, err := net.
Read MoreGo simple TCP server
package main import ( "fmt" "time" "log" "net" "bufio" ) func main() { li, err := net.
Read MoreGo StripPrefix() cumbersome one hands on 9
package main import ( "html/template" "log" "net/http" ) var tpl *template.
Read MoreGo structs
package main import ( "fmt" // "strconv" // "math" "reflect" ) // general way how to define struct type Doctor struct { // if you capitalize key names -> these will be visible for all the other packages Number int ActorName string Companion []string } // anonymous struct // bDoctor := struct{name string}{name: "John Dou"} func structs() { a := Doctor{ Number: 3, ActorName: "Jon Dou", Companion: []string{ "one", "two", "three", }, } fmt.
Read MoreGo switch statement
package main import ( "fmt" // "strconv" // "math" // "reflect" // "math" ) func simpleSwitch() { switch 212 { case 1: fmt.
Read MoreGo template
package main import ( "os" // "io" "fmt" "log" // "strings" "text/template" ) var tpl *template.
Read MoreGo template hotels
package main import ( "os" "log" "text/template" ) type hotel struct { Name string Address string City string Zip []int Region string } var tpl *template.
Read MoreGo templates pipelines
package main import ( "os" "time" "fmt" "log" "math" "text/template" ) var tpl *template.
Read MoreGo upload file
package main import ( "fmt" "io" "io/ioutil" "net/http" ) func main() { http.
Read MoreGo using DefaultMux with nil
package main import ( "io" "net/http" ) type pageDog int func (pd pageDog) ServeHTTP(w http.
Read MoreGo variables
package main import ( "fmt" "strconv" ) // if declaring vatiable over here // you can't use a := 10 var ( a int = 42 actorName string = "Elisabeth Salden" companion string = "Sarah Elisabeth Salden" // example of acronym theHTTP string = "https://google.
Read MoreGo write to file
package main import ( "os" "io" "fmt" "log" "strings" ) func main() { // strongly typed channel name := "Jan" tpl := ` <html> <body> <h1>Hi, this is:` + name + ` </h1> </body> </html> ` fmt.
Read MoreGet Storage Account Keys
az storage account keys list --resource-group erste-dev-slack-rg --account-name erstedevstorage
Read MorePowerShell
Connet to Azure via PowerShell # Connet to Azure via PowerShell Connect-AzAccount
Read MoreAWS ENV Credentials
export AWS_ACCESS_KEY_ID="..." export AWS_SECRET_ACCESS_KEY="..." export AWS_DEFAULT_REGION="eu-central-1"
Read Morecreate ACM certificate
https://medium.com/@Ahmed_Ansar/how-to-setup-aws-vpn-endpoint-8b15e78fd8b0 git clone https://github.com/OpenVPN/easy-rsa.git cd easy-rsa/easyrsa3 ./easyrsa init-pki ./easyrsa build-ca nopass .
Read MoreDelete AWS ENI via cmd
echo $t error waiting for EKS Node Group (eks-mlflow:eks-mlflow-cpu-ng) deletion: Ec2SecurityGroupDeletionFailure: DependencyViolation - resource has a dependent object.
Read MoreHow to aws cli with SSO
(venv) [arch:Downloads ] aws configure sso SSO start URL [None]: https://devopsinuse.
Read MoreDocker push to remote registry via self signed SSL certificate
‘‘CA (Certificate Authority)’’ to your local and copy/paste it to a proper location download from your server scp root@vm027.
Read MoreEID
yay -S pcsc-tools pcsc-light pcsc_scan sudo systemctl start pcscd.service ~/bin/eid/opt/disig/websigner/bin/WebSignerTray & ~/bin/eid/usr/bin/EAC_MW_klient ~/bin/eid/opt/QSign_eSigner/esigner keby neslo spustit tak doinstaluj este aur/eidklient Ohlasovanie voľnej, remeselnej a viazanej živnosti - fyzická osoba
Read MoreHow to trust self-signed SSL/TLS certificates linux
How to enable system wide trust for the private Docker registry: create the symlink:
Read MoreHow to use cryptsetup while installing archlinux
Kriskoviny # boot arch iso and set root passwd passwd systemctl start sshd ssh -l root 192.
Read MoreNotebook serial number
Ak by ste chceli vediet model a seriove cislo svojho notebooku: Serial Number: PF24KS2B $ sudo dmidecode | grep -i serial Serial Number: 00000000 Serial Number: 2C153768 Serial Number: None Serial services are supported (int 14h) Serial Number: PF24KS2B Serial Number: L1HF0B201Z7 Serial Number: PF24KS2B SBDS Serial Number: 0A4A Model: ThinkPad T15 Gen 1 $ sudo dmidecode | grep -i sku Consumer SKU SKU Number: LENOVO_MT_20S6_BU_Think_FM_ThinkPad T15 Gen 1 SKU Number: Not Specified
Read MorePacman setup mirrors and refresh keys
# refresh gpg keys if needed sudo pacman-key --refresh-keys sudo pacman-key --populate archlinux # setup closest mirrors reflector --country Slovakia --country Czechia --protocol https --age 12 --sort rate --save
Read MoreRanger preview images
https://unix.stackexchange.com/questions/632529/alacritty-ranger-w3m-images-are-not-showing-or-disappear-after-few-seconds?newreg=05e6c4f5bf2345e48c22340fd7bee222 I got it working with ueberzug, even inside tmux set preview_images true set use_preview_script true set preview_images_method ueberzug yay -S alacritty sudo pacman -S ueberzug
Read MoreSetup Ubuntu Mono font
yay -S ttf-ubuntu-font-family ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/ ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.
Read MoreDay 4
package main import ( "fmt" "io/ioutil" "os" "regexp" "strconv" "strings" ) func IsValidPartOne(p map[string]interface{}) bool { items := []string{"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"} var count int for _, i := range items { if _, ok := p[i]; ok { count++ } } if count == 7 { return true } return false } func IsValidPartTwo(p map[string]interface{}) bool { items := []string{"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"} var count int for _, i := range items { //fmt.
Read MoreCreate vim function to generate postman tests
function! CreateTest() let a = 0 let names = ['name', 'vlan_id', 'subnet', 'mask', 'name_network', 'description'] let values = ['"*"', 'true', '""', '"some_string"', '0', '-1', '100000', '3.
Read MoreHow to generate TOC by calling external sh
cat ~/bin/tocreadme.sh #!/bin/bash grep "<\!--" $1 | sed -E 's/^(<!
Read MoreVim increment number at irregular rows
[{ "payload": { "data": { "vlan_id": 27, ... } }, "_response": 200, .
Read MoreBackend helm chart running on Kubernetes
sed -E \ -e 's/^(description:).*/\1 Raspberry Pi Backend helm chart/' \ -e 's/^(appVersion:).
Read MoreCreate SD card for Raspberry Pi
lsblk -p NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT /dev/mmcblk0 179:0 0 14.
Read MoreHow to deploy Grafana and Prometheus to Kubernetes cluster via helm
**Deploy K3S at Raspberry Pi 4'' curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644 --tls-san 192.
Read MoreHow to start K3S on Raspberry Pi3
https://blog.alexellis.io/test-drive-k3s-on-raspberry-pi/ cat /boot/config.txt | grep "arm_64bit" arm_64bit=1 vim /boot/cmdline.txt ... cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory .
Read MoreLearn AWS EKS Kubernetes cluster and devops in AWS (Part 1)
Learn AWS EKS Kubernetes cluster and devops in AWS (Part 1) Starting AWS EKS cluster manually in AWS web console
Read MoreLearn DevOps Helm/Helmfile Kubernetes deployment
Section 1: Introduction 1. Welcome to course 2.
Read MoreLearn Kubernetes Docker/DevOps and helm charts from scratch (SW)
Table of contents Run PostgreSQL database locally as docker container Getting started with a helm chart deployment Backend - Python Flask Overview of backend env.
Read More