K8 basics Flashcards
What is a manifest for a docker image?
A single manifest is info about an image such as layers, size and digest
What is kubectl?
A command line tool from Kubernetes for communicating with a Kubernetes cluster
What does it mean to dockerize an app?
The process of packing and app to run in a Docker container (give it everything it needs to run there)
Where is the manifest for Kubernetes deployment?
A manifest is a YAML-formatted representation of the Kubernetes resources that were generated from this release’s chart(s).
This command fetches the generated manifest for a given release.
helm get manifest RELEASE_NAME [flags]
Two ways manifest can be generated
1- by hand (create the yaml) - lives in the repo
2- render a helm chart into a manifest (helm chart can live in the repo or somewhere else like artifactory
Where is the Docker file in our repos?
Depends on teams application repository, depends on the project structure. In SOCR it’s in the ci-cd directory.
How to generate the manifest from a Helm template?
In the pipleline there’s a ‘render-chart’ template that will produce it otherwise do it by hand using the ‘helm template’ + location command
What is needed to run a GitLab CI/CD pipeline?
To use GitLab CI/CD, you need:
Application code hosted in a Git repository.
A file called .gitlab-ci.yml in the root of your repository, which contains the CI/CD configuration.
In the .gitlab-ci.yml file, you can define:
The scripts you want to run.
Other configuration files and templates you want to include.
Dependencies and caches.
The commands you want to run in sequence and those you want to run in parallel.
The location to deploy your application to.
Whether you want to run the scripts automatically or trigger any of them manually.
The scripts are grouped into jobs, and jobs run as part of a larger pipeline. You can group multiple independent jobs into stages that run in a defined order. The CI/CD configuration needs at least one job that is not hidden.
You should organize your jobs in a sequence that suits your application and is in accordance with the tests you wish to perform. To visualize the process, imagine the scripts you add to jobs are the same as CLI commands you run on your computer.
When you add a .gitlab-ci.yml file to your repository, GitLab detects it and an application called GitLab Runner runs the scripts defined in the jobs.
What is a container?
- An isolated environment for your code.
- It has all the files (os, app code, dependencies)
- By definition “it’s a package with the program to execute and all its dependencies, such as the code, runtime, system libraries, et cetera, [all] bound together in a box,”
- Runs in a pod
What is a pod?
- A wrapper or housing for your individual containers when deploying them in Kubernetes.
- Containers for your containers. Think about each pod as a transparent wrapper that would provide a slot for the container.
- A group of pods, related or unrelated, run on a cluster.
- A pod is a unit of replication on a cluster;
- The pod is the smallest deployable object for Kubernetes and will contain one or more containers
What is a node?
- Worker machines, called nodes, that run containerized applications.
- Every cluster has at least one worker node.
- The worker node(s) host the Pods that are the components of the application workload.
What is a cluster?
- Central to thebasic architecture of Kubernetes: If you’re running Kubernetes, you’re running at least one cluster.
- A cluster is like a central nervous system for your application(s).
- A cluster contains nodes (1 or more)
What is a namespace?
A mechanism for isolating groups of resources within a single cluster.
Alternatively, isolation of groups of resources can be done on the clusters (instead of namespaces)
What is an image?
A container image represents binary data that encapsulates an application and all its software dependencies.
List the hierarchy of components (cluster, node, container, etc)
- Cluster
- Node
- Pod
- Container
How to find container id with kubectl
- auth in to system
- kubectl get nodes
- kubectl get pods –namespace (your-namespace)
- locate the desired pod
- kubectl describe pod (pod-name) –namespace –(your-namespace)
- Output shows container info