Kubernetes and Cloud Native Associate (KCNA) flashcards
136 free flashcards. Tap a card to flip it.
Kubernetes Pod Environment Variables
Flip cardEnvironment variables can be passed to containers within a Kubernetes Pod via the `env` field in the container specification. This allows for dynamic configuration of applications.
- Defined as key-value pairs.
- Can be sourced directly or from ConfigMaps/Secrets.
- Used for application configuration without rebuilding the container image.
Memory trick: Environment Enriches Execution
Node Selector
Flip cardA field in a Pod's specification that specifies a map of key-value pairs. For the Pod to be eligible to run on a node, the node must have each of the indicated key-value pairs as labels.
- Constrains Pods to specific nodes.
- Uses node labels for matching.
- Simple, hard requirement.
Memory trick: Selector selects the perfect node!
Container command field
Flip cardThe `command` field in a Kubernetes container specification allows overriding the `ENTRYPOINT` defined in the Docker image, specifying the executable to run.
- Overrides the image's `ENTRYPOINT`.
- Corresponds to the `CMD` instruction if `ENTRYPOINT` is not set.
- Should be an array of strings (executable and its fixed arguments).
- `args` field provides additional arguments.
Memory trick: Command the Entrypoint, Args for the CMD.
Pod `image` field
Flip cardThe `image` field within a container's specification (`spec.containers[].image`) in a Kubernetes Pod manifest, used to define the Docker image to be pulled and run for that container.
- Located under `spec.containers`.
- Specifies the image name and optional tag (e.g., `myrepo/myimage:v1.0`).
- Crucial for defining the application's executable component.
Memory trick: Containers Contain Images and Names.
Pod `metadata.labels`
Flip cardA field within a Kubernetes Pod's `metadata` section that defines a set of key-value pairs. These labels are used by Services and other controllers to identify and select specific Pods.
- Used for identifying and grouping Kubernetes objects.
- Crucial for Service-to-Pod mapping via selectors.
- Part of `metadata` at the top level of the resource.
Memory trick: Metadata Makes Labels Link.
Pod restartPolicy: OnFailure
Flip cardThe `OnFailure` restart policy specifies that a container will only be restarted if it exits with a non-zero exit code, indicating an error.
- Container is restarted if it fails.
- Container is NOT restarted if it succeeds (exit code 0).
- Commonly used for Jobs or other batch-like processes.
- Can be set at the Pod level.
Memory trick: Restart On Failure, but Never if it's Always successful.
kube-controller-manager
Flip cardA control plane component that runs various controller processes, continuously monitoring the cluster's actual state and attempting to move it towards the desired state.
- Runs multiple controllers.
- Monitors actual vs. desired state.
- Reconciles discrepancies (e.g., in Deployments, ReplicaSets).
Memory trick: Controllers manage the cluster's desired state!
Kubernetes NodePort Service
Flip cardA NodePort Service exposes a Service on a static port (NodePort) on each Node's IP address. This makes the Service accessible from outside the cluster by requesting `<NodeIP>:<NodePort>`.
- Makes the service accessible externally.
- A port is opened on every node in the cluster.
- The NodePort value is typically in the range 30000-32767.
Memory trick: NodePort Opens Nodes to the Outside
Pod hostNetwork
Flip cardA Pod configuration that allows its containers to use the network namespace of the host node, effectively bypassing the Kubernetes network model.
- Pod shares host's network stack.
- Bypasses CNI plugin networking.
- Pod's ports are directly on the host's IP.
Memory trick: HostNetwork: Pod's network is the Host's network!
kubectl apply
Flip cardThe `kubectl apply` command is used for applying changes to Kubernetes resources defined in a file. It creates the resource if it doesn't exist or updates it if it does, based on the file's content.
- Idempotent: running it multiple times has the same effect.
- Uses server-side apply (or client-side apply) to merge changes.
- Preferred method for declarative configuration management.
Memory trick: Apply Always Adapts
Pod 'Pending' State
Flip cardA Pod in the 'Pending' state means it has been accepted by the Kubernetes cluster but one or more of its containers has not been created or started yet. This often indicates a scheduling issue.
- Common causes: insufficient resources (CPU/memory) on nodes.
- Also caused by unbound PVCs, node selectors/affinity not matching.
- Use `kubectl describe pod <pod-name>` to get scheduler events and reasons.
Memory trick: Pending Pods Ponder Placement Problems
kubectl version
Flip cardA `kubectl` command used to display the version information of both the `kubectl` client and the Kubernetes API server.
- Shows client and server versions.
- Includes Git commit and build date.
- Essential for compatibility checks and troubleshooting.
Memory trick: To know the versions, just ask for the 'version'!
Kubernetes DaemonSet
Flip cardA Kubernetes object that ensures a copy of a specific Pod runs on all (or some) nodes in a cluster, typically used for cluster-level services like log collection or monitoring agents.
- One Pod instance per node (or selected nodes).
- Ideal for node-level agents.
- Ensures continuous presence on nodes.
Memory trick: DaemonSet: Demons on every node!
ImagePullBackOff
Flip cardAn 'ImagePullBackOff' status in Kubernetes indicates that a container image specified in a Pod's manifest could not be pulled from the container registry.
- Common causes: incorrect image name/tag, private registry access issues, registry down.
- Node repeatedly tries to pull the image.
- Check `kubectl describe pod <pod-name>` for more details on the pull error.
Memory trick: Pulling Problems Prevent Pods from Proceeding
Container `command` and `args`
Flip cardFields in a Kubernetes container specification that define the entrypoint and arguments for the container, overriding image defaults.
- `command` overrides the `ENTRYPOINT` in the Dockerfile.
- `args` overrides the `CMD` in the Dockerfile (if `command` is also specified, `args` becomes arguments to `command`).
- Used for customizing container execution behavior.
Memory trick: Command and Args are like giving direct instructions to your container.
HorizontalPodAutoscaler (HPA)
Flip cardA Kubernetes API resource that automatically scales the number of Pod replicas in a Deployment or ReplicaSet based on observed CPU utilization or other select metrics.
- Automatically adjusts Pod count.
- Targets Deployments or ReplicaSets.
- Uses CPU utilization or custom metrics.
Memory trick: HPA: 'How Pods Auto-scale'