{"id":18368887,"url":"https://github.com/claudio-code/k8s-ckad-simulated","last_synced_at":"2025-06-21T00:08:42.644Z","repository":{"id":160750956,"uuid":"635565344","full_name":"Claudio-code/k8s-ckad-simulated","owner":"Claudio-code","description":":memo: Preparing to take the certification","archived":false,"fork":false,"pushed_at":"2024-08-07T00:23:39.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T21:16:31.700Z","etag":null,"topics":["k8s"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Claudio-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-03T01:07:41.000Z","updated_at":"2024-08-07T00:23:43.000Z","dependencies_parsed_at":"2024-03-01T19:40:51.774Z","dependency_job_id":"bac90490-048e-4399-9596-647ec35997e1","html_url":"https://github.com/Claudio-code/k8s-ckad-simulated","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Claudio-code/k8s-ckad-simulated","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Claudio-code%2Fk8s-ckad-simulated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Claudio-code%2Fk8s-ckad-simulated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Claudio-code%2Fk8s-ckad-simulated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Claudio-code%2Fk8s-ckad-simulated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Claudio-code","download_url":"https://codeload.github.com/Claudio-code/k8s-ckad-simulated/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Claudio-code%2Fk8s-ckad-simulated/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261039108,"owners_count":23100975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["k8s"],"created_at":"2024-11-05T23:27:46.352Z","updated_at":"2025-06-21T00:08:37.601Z","avatar_url":"https://github.com/Claudio-code.png","language":null,"readme":"# k8s-ckad-simulated\n\n### Change k8s editor to nano\n\n```bash\n\necho \"source \u003c(kubectl completion bash)\" \u003e\u003e ~/.bashrc\n\nautoload -U +X bashcompinit \u0026\u0026 bashcompinit\nautoload -U +X compinit \u0026\u0026 compinit\n\nexport KUBE_EDITOR=nano\n\nalias la='ls -A'\nalias ll='ls -alF'\nalias l='ls -CF'\n\nalias k=kubectl\ncomplete -F __start_kubectl k\nalias kgp='kubectl get pod'\nalias kd='kubectl describe'\nexport d=\"--dry-run=client -o yaml\"\n\n\n## Config nano\nnano .nanorc\n\nset tabsize 2\nset tabstospaces\n\n## Config vim\n\nvim .vimrc\n\nset expandtab\nset autochdir\nset tabstop=2\nset shiftwidth=2\nsyntax on\n```\n\n### Command to create cronjob with command\n```bash\nkubectl create cronjob --image=ubuntu --schedule=\"* * * * *\" --dry-run=client -o yaml \u003e my-file.yaml\n```\n\n\n### Command to create resource quota in kubectl\n\n```bash\nkubectl create quota quota2 --hard pod=2,cpu=2,memory=1Gi --dry-run=client -o yaml\n```\n\n### Command to found resource using api-resource in kubectl\n\n```bash\nkubectl api-resources -o wide | grep \u003cresource-name\u003e\n```\n\n### Command to verify if user was permission in many different resources in k8s\n\n```bash\nkubectl auth can-i get secrets --as system:serviceaccount:default:reader\n```\n\n### Create Role with command\n\n```bash\nkubectl create role leitor2 --verb get,watch, list --resource secrets --dry-run=client -o yaml\n```\n\n### Create ClusterRole with command\n\n```bash\nkubectl create clusterrole readerTwo --verb get, watch, list --resource secrets --dry-run=client -o yaml\n```\n\n### Create ServiceAccount\n\n```bash\nkubectl create sa reader --dry-run=client -o yaml\n### Create Ingress in kubectl command line\n\n```bash\n## ingress by path\nk create ingress ingress2 --class nginx --rule=\"/foo=foo-nginx:80\" --dry-run=client -o yaml\n\n## ingress by host\nk create ingress ingress2 --class nginx --rule=\"foo.possuidao.xyy/foo=foo-nginx:80\" --dry-run=client -o yaml\n```\n\n### Filter outputs in when get infos of kubectl\n\n```bash\n\nk get pods -o=name \u003e /tmp/pods\n\n```\n\n### Force delete/replace pod\n\n```bash\n\n## to delete\nk delete po pod-name --force --grace-period 0\n\n## to replace\nk replace -f ./manifest.yaml --force --grace-period 0\n\n```\n\n### Create deployment and generate manifest\n\n```bash\nk create deployment firstdeploy --image=nginx --dry-run=client -o yaml \u003e firstdeploy.yaml\n```\n\n### Create pod and generate manifest\n\n```bash\n\nk run nginx --image nginx --port 80 --dry-run=client -o yaml \u003e manifest-pod.yaml\n\n```\n\n### Create service in command line\n\n```bash\nk expose pod pod-name --target-port 80 --port 80\n```\n\n### Pass command to execute in pod\n\n```bash\nk exec -it second-pod -- curl 10.42.0.2\n```\n\n### Get info of pod and print manifest in terminal\n\n```bash\n\nk get po pod-name -o yaml\n\n```\n\n### Delete all pods\n\n```bash\n\nk delete --all pods\n\n# OR\n\nk delete --all po\n\n# OR OF SPECIFIC NAMESPACE\n\nk delete --all po --namespace=default\n\n```\n\n### Enter in pod with two containers\n\n```bash\n\nk exec -it nginx -c nginx -- bash\n\n```\n\n### Get all info of specific pod\n\n```bash\n\nk describe po nginx\n\n```\n\n### Find how make configs in manifest with terminal doc\n\n```bash\n\n### Complete info\nk explain pod.spec.containers\n\n### Just examples\nk explain pod.spec.containers --recursive\n\n```\n\n### Force delete pod\n\n```bash\nk delete po my-pod nginx sleep --force --grace-period 0\n```\n\n### Create deployment more fast\n\n```bash\nk create deployment nginx --image nginx -o yaml --dry-run=client \u003e replica-set-two.yaml\n```\n\n### How edit deployment when it is running\n\n```bash\nk edit deployments.app first-deploy\n## OR\nk edit deploy first-deploy\n```\n\n### How set scale in deployment running\n\n```bash\nk scale deployment --replica 6 first-deploy\n## OR\nk scale deploy --replica 1 first-deploy\n```\n\n### How see all changes in deployment\n\n```bash\nk rollout history deployment first-deploy\n## OR\nk rollout history deploy first-deploy\n```\n\n### Make rollback to previous version\n\n```bash\nk rollout undo --to-revision 1 deploy first-deploy\n```\n\n### Generate manifest of pod\n\n```bash\nk run nginx --image nginx --dry-run=client -o yaml \u003e pod-pvc.yaml\n```\n\n---\n\n## PersistentVolumeClaim\n\n```yaml\napiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\n  name: pvc-first\nspec:\n  accessModes:\n    - ReadWriteOnce\n  resources:\n    requests:\n      storage: 1Gi\n```\n\n### PersistentVolumeClaim to test\n\n\u003e spec\n\n#### accessModes\n\n```yaml\naccessModes:\n  - [ReadWriteOnce | ReadOnlyMany | ReadWriteMany]\n```\n\n- ReadWriteOnce: The volume can mount with read and write by only node.\n- ReadOnlyMany: The volume can mount only read to many nodes.\n- ReadWriteMany: The volume can mount with read and write to many nodes.\n\n#### class\n\n\u003e Determine which will be the storageClass to PV will use.\n\n```yaml\nstorageClassName: \"Slow\"\n```\n\n#### resources\n\n\u003e Like pods can solicit specifics quantities of one resource. the solicitation is to storage.\n\n```yaml\nresources:\n  requests:\n    storage: 9Gi\n```\n\n#### volumeName\n\n\u003e Force the use specific PV\n\n```yaml\nvolumeName: firstPV\n```\n\n#### selector\n\n\u003e The PVCS can specific one \"label selector\" to filter further process to one PV\n\n```yaml\nselector: # [matchLabels | matchExpressions]\n  matchLabels:\n    release: \"dev\"\n  mathExpression:\n    - { key: enviroment, operator: In, values: [dev] }\n```\n\n- matchLabels: The volume must have one label with it value.\n- matchExpressions: One list of requirements made specific key, list of values and operator to relate key and operator. The operators valid include in, notIn, Exists and DoesNotExists.\n\n#### Example in pod\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  labels:\n    run: nginx\n  name: nginx\n  namespace: day1\nspec:\n  containers:\n    - image: nginx\n      name: nginx\n      volumeMounts:\n        - name: usingpvc\n          mountPath: /data\n  dnsPolicy: ClusterFirst\n  restartPolicy: Always\n  volumes:\n    - name: usingpvc\n      persistentVolumeClaim:\n        claimName: pvc-first\n```\n\n---\n\n## PersistentVolume\n\n```yaml\napiVersion: v1\nkind: PersistentVolume\nmetadata:\n  name: firstPV\nspec:\n  storageClassName: \"\"\n  capacity:\n    storage: 1Gi\n  accessModes:\n    - ReadWriteOnce\n  hostPath:\n    path: \"/home\"\n```\n\n### PersistentVolume to test\n\n\u003e spec\n\n#### Capacity\n\nSpecific storage size of persistence volume ( Gi Mi )\n\n```yaml\ncapacity:\n  storage: 1Gi\n```\n\n#### VolumeMode\n\n```yaml\nvolumeMode: [Filesystem | Block]\n```\n\n#### AccessMode\n\n```yaml\naccessMode:\n  - [ReadWriteOnce | ReadOnlyMany | ReadWriteMany]\n```\n\n- ReadWriteOnce: The volume could it be mounted with read and write to one node.\n- ReadOnlyMany: The volume could it be mounted with only read to many nodes.\n- ReadWriteMany: The volume could it be mounted with read and write to many nodes.\n\n#### Reclaim Policy\n\n\u003e It option has the objective the action that the cluster will make after exclude PVC.\n\n```yaml\npersistentVolumeReclaimPolicy: [Retain | Recycle | Delete]\n```\n\n- Retain: Need one manual action.\n- Recycle: basic (rm -rf /volumeDir/\\*).\n- Delete: Using AWS EBS, GCE PD, Azure Disk or OpenStack Cinder the volume as deleted.\n\n#### Class\n\n\u003e Determine which will be the storageClass to PV will use.\n\n```yaml\nstorageClassName: \"Slow\"\n```\n\n#### HostPath\n\n\u003e One volume hostPath mount one file or directory of filesystem of node of host in your pod.\n\n```yaml\nhostPath:\n  path:\n  type: [FileOrCreate | DirectoryOrCreate]\n```\n\n- FileOrCreate: If nothing exist in path provided, one file empty will be created there as need with permission like 0644, having the same group and properties of kubelet.\n- DirectoryOrCreate: If no exist in path provided, one directory empty will be created there as need with defined permission like 0755, having the same group and property of kubelet.\n\n## ConfigMap and Secrets\n\n### How fast create configMap\n\n````yaml\nk create configmap second-cm --from-literal=ip=22.2.2.22 --from-literal=server=web --dry-run=client -o yaml\n## Secret\n\nSecret encode all values in base64 you can test it encode using it command:\n\nEncode:\n\n```bash\n  echo -n \"senha\" | base64\n````\n\nDecode:\n\n```bash\n  echo -n \"dXNlcg==\" | base64 -d\n```\n\n### Create secret from file\n\n```bash\nk create secret generic my-secret --from-file=./secrets.txt --from-file=./another-secrets.txt\n```\n\n### Create secret literal\n\n```bash\nk create secret generic my-secret --from-literal=user=admin --from-literal=pass=mysecretpass\n```\n\n### Create secret to docker register\n\n```bash\nk create secret docker-registry my-docker \\\n  --docker-username=admin \\\n  --docker-password=pass123 \\\n  --docker-email=admin@soneca.corp.com\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaudio-code%2Fk8s-ckad-simulated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclaudio-code%2Fk8s-ckad-simulated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclaudio-code%2Fk8s-ckad-simulated/lists"}