Skip to main content

Command Palette

Search for a command to run...

DevOps Interview

Updated
โ€ข19 min read

1.Q. How are your day-to-day activities as a DevOps Engineer?

Monitoring infrastructure

Writing/maintaining IaC

Improving pipelines

Handling releases

Supporting dev teams

Troubleshooting incidents

On a typical day, I monitor production clusters, manage and improve our Jenkins pipelines, work on Terraform modules for resource provisioning, and collaborate with developers for application releases. I also handle incidents like pod failures or networking issues.โ€

2.What is a ConfigMap, and how is it different from a Secret?

ChatGPT said:

๐Ÿ”น What is a ConfigMap in Kubernetes?

A ConfigMap is an object used to store non-sensitive configuration data in key-value pairs. It decouples configuration artifacts from container images so that your application can be more portable and environment-agnostic.


๐Ÿ”น What is a Secret in Kubernetes?

A Secret is also a key-value store, but it is specifically designed to store sensitive data such as passwords, tokens, SSH keys, and certificates. Secrets are base64-encoded and can be mounted as files or exposed as environment variables.


๐Ÿ”ธ Key Differences Between ConfigMap and Secret

FeatureConfigMapSecret
PurposeStore non-sensitive config dataStore sensitive data like credentials
EncodingPlaintextBase64-encoded (not encrypted by default)
Access RestrictionsSame as any resourceMore restrictive access via RBAC
Default StorageStored in etcd as plain textStored in etcd but can be encrypted at rest
Use CasesApp settings, URLs, feature flagsPasswords, API keys, tokens

๐Ÿ”ธ Example: ConfigMap YAML

yamlCopyEditapiVersion: v1
kind: ConfigMap
metadata:
  name: my-config
data:
  APP_MODE: production
  LOG_LEVEL: debug

๐Ÿ”ธ Example: Secret YAML

yamlCopyEditapiVersion: v1
kind: Secret
metadata:
  name: my-secret
type: Opaque
data:
  DB_PASSWORD: cGFzc3dvcmQ=     # "password" in base64

You can create a secret like this:

bashCopyEditkubectl create secret generic my-secret --from-literal=DB_PASSWORD=password

๐Ÿ”น How They're Used in Pods

As environment variables:env: - name: APP_MODE valueFrom: configMapKeyRef: name: my-config key: APP_MODE

For secrets:

env:
- name: DB_PASSWORD
  valueFrom:
    secretKeyRef:
      name: my-secret
      key: DB_PASSWORD

๐Ÿง  TL;DR

Use ConfigMap for:Use Secret for:
App configs, flagsPasswords, tokens, keys
Log levels, URLsSSH certs, DB credentials

Let me know if you want a live example or need to mount these into a pod as volumes.

3.How do you check network connectivity between two servers?
ChatGPT said:

To check network connectivity between two servers, you can use a combination of basic and advanced tools depending on the depth of diagnostics you need.


๐Ÿ”น 1. Ping โ€“ Check basic network reachability

ping <destination-ip-or-hostname>
  • Example:

      ping server2.example.com
    

โœ… Verifies:

  • Network is reachable

  • ICMP is allowed (some firewalls block it)


๐Ÿ”น 2. Traceroute โ€“ Show network path and latency per hop

traceroute <destination>
  • Example:

      traceroute server2.example.com
    

โœ… Verifies:

  • Intermediate hops

  • Latency and where the path is breaking

๐Ÿ“ฆ Install if missing:

tsudo apt install traceroute    # Debian/Ubuntu
sudo yum install traceroute    # RHEL/CentOS

๐Ÿ”น 3. Telnet / Netcat (nc) โ€“ Check if a port is open on a remote server

telnet <destination> <port>
  • Example:

      telnet server2.example.com 22
    

Or use nc (netcat):

bashCopyEditnc -zv server2.example.com 22

โœ… Verifies:

  • TCP port connectivity (SSH, HTTP, DB ports, etc.)

๐Ÿ”น 4. SSH โ€“ Try to connect directly (if SSH is open)

ssh user@server2.example.com

โœ… Verifies:

  • Network + port 22 + authentication

๐Ÿ”น 5. curl / wget โ€“ Test web service or API endpoint

curl http://server2.example.com:8080

โœ… Verifies:

  • HTTP connectivity

  • Service response (status codes, headers)


๐Ÿ”น 6. nmap โ€“ Scan ports on a remote server

nmap -p 1-65535 server2.example.com

โœ… Verifies:

  • Which ports are open/filtered/closed

๐Ÿ“ฆ Install if needed:

sudo apt install nmap

๐Ÿ”น 7. ip/ifconfig + netstat/ss โ€“ Debug local networking issues

Check local interfaces:

ip a

Check listening ports:

ss -tuln

๐Ÿง  Pro Tip: Combine tools

If ping works but telnet/nc to port fails โ†’ likely a firewall or port blocking issue.

If telnet works but curl fails โ†’ likely a service issue on the remote server.


Let me know the OS type and specific use case (e.g., Kubernetes node check, internal servers, across VPN) and I can tailor the commands more precisely.

4.Q. What is a NAT Gateway?
Allows private subnets to access the internet Without exposing resources to incoming trac Managed by AWS โœ… Scenarios โ€œWe had EC2 instances in private subnets that needed to pull Docker images from public repos. We placed a NAT Gateway in a public subnet, routing private subnet trac through it so those instances could reach the internet safely.โ€ โ€œIn my last project, the private subnets for EC2 instances needed to pull OS updates from the internet. I used a NAT gateway in the public subnet, routing trac through it, while blocking inbound access to those instances.โ€ Diagram Internet-> IGW โ†’ NAT Gateway โ†’ Private Subnet EC2 Advanced Q&A Q: Can a NAT Gateway receive inbound trac? A: No โ€” it only handles outbound requests from private subnets. Best practices Always place a NAT gateway in a public subnet Remember, private subnet routes point to the NAT

5.Frequently asked Kubernetes questions with practical ๐˜€๐—ฐ๐—ฒ๐—ป๐—ฎ๐—ฟ๐—ถ๐—ผ๐˜€.. you must read once

๐Ÿง  ๐Ÿญ. ๐—–๐—ต๐—ฒ๐—ฐ๐—ธ ๐—ก๐—ผ๐—ฑ๐—ฒ ๐—›๐—ฒ๐—ฎ๐—น๐˜๐—ต
โ€œ๐˜๐˜ด ๐˜ต๐˜ฉ๐˜ฆ ๐˜ค๐˜ญ๐˜ถ๐˜ด๐˜ต๐˜ฆ๐˜ณ ๐˜ฉ๐˜ฆ๐˜ข๐˜ญ๐˜ต๐˜ฉ๐˜บ?โ€
kubectl get nodes
kubectl describe node <node-name>

๐Ÿ“ฆ ๐Ÿฎ. ๐——๐—ฒ๐—ฏ๐˜‚๐—ด ๐—ฎ ๐—–๐—ฟ๐—ฎ๐˜€๐—ต๐—ถ๐—ป๐—ด ๐—ฃ๐—ผ๐—ฑ
โ€œ๐˜ž๐˜ฉ๐˜บ ๐˜ช๐˜ด ๐˜ฎ๐˜บ ๐˜ฑ๐˜ฐ๐˜ฅ ๐˜ง๐˜ข๐˜ช๐˜ญ๐˜ช๐˜ฏ๐˜จ?โ€
kubectl logs <pod-name>
kubectl logs <pod-name> --previous

๐Ÿ–ฅ๏ธ ๐Ÿฏ. ๐—˜๐˜…๐—ฒ๐—ฐ ๐—ถ๐—ป๐˜๐—ผ ๐—ฎ ๐—ฃ๐—ผ๐—ฑ
โ€œ๐˜•๐˜ฆ๐˜ฆ๐˜ฅ ๐˜ด๐˜ฉ๐˜ฆ๐˜ญ๐˜ญ ๐˜ข๐˜ค๐˜ค๐˜ฆ๐˜ด๐˜ด ๐˜ง๐˜ฐ๐˜ณ ๐˜ฅ๐˜ฆ๐˜ฃ๐˜ถ๐˜จ๐˜จ๐˜ช๐˜ฏ๐˜จ.โ€
kubectl exec -it <pod-name> -- /bin/bash

๐ŸŒ ๐Ÿฐ. ๐—˜๐˜…๐—ฝ๐—ผ๐˜€๐—ฒ ๐—ฎ ๐——๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—บ๐—ฒ๐—ป๐˜
โ€œ๐˜Œ๐˜น๐˜ฑ๐˜ฐ๐˜ด๐˜ฆ ๐˜ข๐˜ฑ๐˜ฑ ๐˜ท๐˜ช๐˜ข ๐˜•๐˜ฐ๐˜ฅ๐˜ฆ๐˜—๐˜ฐ๐˜ณ๐˜ต.โ€
kubectl expose deployment <name> --port=80 --target-port=8080 --type=NodePort

๐Ÿ“ˆ ๐Ÿฑ. ๐—ฆ๐—ฐ๐—ฎ๐—น๐—ฒ ๐—ฌ๐—ผ๐˜‚๐—ฟ ๐—”๐—ฝ๐—ฝ
โ€œ๐˜๐˜ฏ๐˜ค๐˜ณ๐˜ฆ๐˜ข๐˜ด๐˜ฆ ๐˜ฑ๐˜ฐ๐˜ฅ ๐˜ค๐˜ฐ๐˜ถ๐˜ฏ๐˜ต ๐˜ต๐˜ฐ ๐˜ฉ๐˜ข๐˜ฏ๐˜ฅ๐˜ญ๐˜ฆ ๐˜ต๐˜ณ๐˜ข๐˜ง๐˜ง๐˜ช๐˜ค.โ€
kubectl scale deployment <name> --replicas=5

๐Ÿ”„ ๐Ÿฒ. ๐—จ๐—ฝ๐—ฑ๐—ฎ๐˜๐—ฒ ๐——๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—บ๐—ฒ๐—ป๐˜ ๐—œ๐—บ๐—ฎ๐—ด๐—ฒ
โ€œ๐˜™๐˜ฐ๐˜ญ๐˜ญ ๐˜ฐ๐˜ถ๐˜ต ๐˜ข ๐˜ฏ๐˜ฆ๐˜ธ ๐˜ข๐˜ฑ๐˜ฑ ๐˜ท๐˜ฆ๐˜ณ๐˜ด๐˜ช๐˜ฐ๐˜ฏ.โ€
kubectl set image deployment/<name> <container>=<image>:<tag>

๐Ÿ“ ๐Ÿณ. ๐—ฃ๐—ผ๐—ฑ-๐˜๐—ผ-๐—ก๐—ผ๐—ฑ๐—ฒ ๐— ๐—ฎ๐—ฝ๐—ฝ๐—ถ๐—ป๐—ด
โ€œ๐˜ž๐˜ฉ๐˜ฆ๐˜ณ๐˜ฆ ๐˜ช๐˜ด ๐˜ต๐˜ฉ๐˜ช๐˜ด ๐˜ฑ๐˜ฐ๐˜ฅ ๐˜ณ๐˜ถ๐˜ฏ๐˜ฏ๐˜ช๐˜ฏ๐˜จ?โ€
kubectl get pods -o wide

๐Ÿ” ๐Ÿด. ๐—จ๐˜€๐—ฒ ๐—ฆ๐—ฒ๐—ฐ๐—ฟ๐—ฒ๐˜๐˜€ ๐—ฆ๐—ฒ๐—ฐ๐˜‚๐—ฟ๐—ฒ๐—น๐˜†
โ€œ๐˜๐˜ฏ๐˜ซ๐˜ฆ๐˜ค๐˜ต ๐˜‹๐˜‰ ๐˜ค๐˜ณ๐˜ฆ๐˜ฅ๐˜ฆ๐˜ฏ๐˜ต๐˜ช๐˜ข๐˜ญ๐˜ด ๐˜ช๐˜ฏ๐˜ต๐˜ฐ ๐˜ฑ๐˜ฐ๐˜ฅ๐˜ด.โ€
kubectl create secret generic db-creds --from-literal=username=admin --from-literal=password=pass123

๐Ÿ“œ ๐Ÿต. ๐—”๐—ฝ๐—ฝ๐—น๐˜† ๐—ฌ๐—”๐— ๐—Ÿ ๐—–๐—ต๐—ฎ๐—ป๐—ด๐—ฒ๐˜€
โ€œ๐˜œ๐˜ฑ๐˜ฅ๐˜ข๐˜ต๐˜ฆ ๐˜ค๐˜ฐ๐˜ฏ๐˜ง๐˜ช๐˜จ ๐˜ท๐˜ช๐˜ข ๐˜ง๐˜ช๐˜ญ๐˜ฆ.โ€
kubectl apply -f deployment.yaml

โ†ฉ๏ธ ๐Ÿญ๐Ÿฌ. ๐—ฅ๐—ผ๐—น๐—น๐—ฏ๐—ฎ๐—ฐ๐—ธ ๐—ฎ ๐—•๐—ฎ๐—ฑ ๐——๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—บ๐—ฒ๐—ป๐˜
โ€œ๐˜œ๐˜ฏ๐˜ฅ๐˜ฐ ๐˜ข ๐˜ง๐˜ข๐˜ช๐˜ญ๐˜ฆ๐˜ฅ ๐˜ณ๐˜ฐ๐˜ญ๐˜ญ๐˜ฐ๐˜ถ๐˜ต.โ€
kubectl rollout undo deployment/<name>

โš ๏ธ ๐Ÿญ๐Ÿญ. ๐——๐—ฟ๐—ฎ๐—ถ๐—ป ๐—ฎ ๐—ก๐—ผ๐—ฑ๐—ฒ
โ€œ๐˜—๐˜ณ๐˜ฆ๐˜ฑ ๐˜ฏ๐˜ฐ๐˜ฅ๐˜ฆ ๐˜ง๐˜ฐ๐˜ณ ๐˜ฎ๐˜ข๐˜ช๐˜ฏ๐˜ต๐˜ฆ๐˜ฏ๐˜ข๐˜ฏ๐˜ค๐˜ฆ.โ€

kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data

๐Ÿ›‘ ๐Ÿญ๐Ÿฎ. ๐—ง๐—ฎ๐—ถ๐—ป๐˜ ๐—ฎ ๐—ก๐—ผ๐—ฑ๐—ฒ
โ€œ๐˜™๐˜ฆ๐˜ด๐˜ฆ๐˜ณ๐˜ท๐˜ฆ ๐˜ข ๐˜ฏ๐˜ฐ๐˜ฅ๐˜ฆ ๐˜ง๐˜ฐ๐˜ณ ๐˜ด๐˜ฑ๐˜ฆ๐˜ค๐˜ช๐˜ข๐˜ญ ๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ๐˜ญ๐˜ฐ๐˜ข๐˜ฅ๐˜ด.โ€
kubectl taint nodes <name> key=value:NoSchedule

๐Ÿ“‚ ๐Ÿญ๐Ÿฏ. ๐—ช๐—ผ๐—ฟ๐—ธ ๐˜„๐—ถ๐˜๐—ต ๐—ก๐—ฎ๐—บ๐—ฒ๐˜€๐—ฝ๐—ฎ๐—ฐ๐—ฒ๐˜€
โ€œ๐˜š๐˜ฆ๐˜ฑ๐˜ข๐˜ณ๐˜ข๐˜ต๐˜ฆ ๐˜ฆ๐˜ฏ๐˜ท๐˜ช๐˜ณ๐˜ฐ๐˜ฏ๐˜ฎ๐˜ฆ๐˜ฏ๐˜ต๐˜ด.โ€

kubectl create namespace dev kubectl config set-context --current --namespace=dev

๐Ÿ” ๐Ÿญ๐Ÿฐ. ๐—–๐—ฟ๐—ฎ๐˜€๐—ต๐—Ÿ๐—ผ๐—ผ๐—ฝ๐—•๐—ฎ๐—ฐ๐—ธ๐—ข๐—ณ๐—ณ ๐——๐—ฒ๐—ฏ๐˜‚๐—ด
โ€œ๐˜—๐˜ฐ๐˜ฅ ๐˜ฌ๐˜ฆ๐˜ฆ๐˜ฑ๐˜ด ๐˜ณ๐˜ฆ๐˜ด๐˜ต๐˜ข๐˜ณ๐˜ต๐˜ช๐˜ฏ๐˜จ โ€” ๐˜ธ๐˜ฉ๐˜บ?โ€
kubectl describe pod <name>

kubectl logs <name> --previous

  1. ๐—ค. When auto-scaling instances, how do you manage the backend RDS database?
    ๐—”. To manage the backend RDS database during auto-scaling:
    โ—‹ Enable Multi-AZ for high availability and automatic failover.
    โ—‹ Use RDS Read Replicas to handle read-heavy traffic, reducing the load on the primary database.
    โ—‹ Scale RDS vertically (instance size) or horizontally (read replicas) based on the database workload.
    โ—‹ Monitor performance using Amazon CloudWatch and adjust as necessary.

    ๐—ค. Have you ever set up cross-account access for S3? For example, if the QA team needs access
    to the production database.
    -> Yes, I've set up cross-account access by:
    โ—‹ Creating an IAM role in the production account with the necessary S3 permissions.
    โ—‹ Establishing a trust relationship to allow the QA account to assume that role.
    โ—‹ Using S3 bucket policies to grant access from the QA account.
    โ—‹ QA team members can then assume the role using AWS STS (Security Token Service) to access the production S3 bucket.

    ๐—ค. How can an S3 account in Account A access an S3 account in Account B?
    ๐—”. Account A can access Account Bโ€™s S3 bucket by:
    โ—‹ Setting up a bucket policy in Account B that grants Account A the necessary permissions.
    โ—‹ Creating an IAM role in Account B with permissions for S3 and allowing Account A to assume that role via a trust policy.
    โ—‹ Using AWS STS to assume the role from Account A and access the S3 bucket in Account B.

    ๐—ค. Are you familiar with lifecycle management in S3 buckets? How do you set up lifecycle policies?
    ๐—”. Yes, lifecycle management in S3 allows you to define rules to transition objects between different storage classes or delete them after a certain period. Lifecycle policies can be set up using the S3 Management Console, AWS CLI, or Terraform by specifying the transitions and expiration actions in a JSON configuration file.

    ๐—ค. Can you explain the STS assume role policy?
    ๐—”. The STS (Security Token Service) AssumeRole policy allows a user or service to assume a
    role in a different account or within the same account. This provides temporary security credentials with the permissions associated with the assumed role, enabling cross-account access or delegation of permissions.

    ๐—ค. What are the types of storage accounts in AWS S3?
    ๐—”. In AWS S3, the different storage classes include:
    โ—‹ S3 Standard
    โ—‹ S3 Intelligent-Tiering
    โ—‹ S3 Standard-IA (Infrequent Access)
    โ—‹ S3 One Zone-IA
    โ—‹ S3 Glacier
    โ—‹ S3 Glacier Deep Archive

    ๐—ค. What is the maximum number of S3 buckets you can
    create?
    Ans. 100

    ๐—ค. How many total VPCs per account/region and subnets per
    VPC can you have?
    Ans. 5, 200

  2. ๐—ค. ๐—–๐—ฎ๐—ป ๐˜†๐—ผ๐˜‚ ๐˜€๐—ต๐—ฎ๐—ฟ๐—ฒ ๐—ฎ๐—ป ๐—ถ๐—ป๐˜€๐˜๐—ฎ๐—ป๐—ฐ๐—ฒ ๐˜„๐—ต๐—ฒ๐—ฟ๐—ฒ ๐˜†๐—ผ๐˜‚ ๐—ฝ๐—ฟ๐—ผ๐˜ƒ๐—ถ๐—ฑ๐—ฒ๐—ฑ ๐—ฎ ๐˜€๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป ๐—ณ๐—ผ๐—ฟ ๐—ฐ๐—ผ๐˜€๐˜ ๐—ผ๐—ฝ๐˜๐—ถ๐—บ๐—ถ๐˜‡๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐˜„๐—ต๐—ถ๐—น๐—ฒ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ถ๐—ป๐—ด ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ ๐—ฎ๐—น๐—น๐—ผ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป?
    Our cloud infrastructure was over-provisioned, leading to unnecessary costs.
    I implemented auto-scaling based on actual usage metrics and utilized spot instances for non-critical workloads.
    Additionally, I restructured the storage solution by moving infrequently accessed data to lower-cost storage classes. These changes resulted in a significant reduction in our monthly cloud expenses without compromising performance.

    ๐—ค. ๐—–๐—ฎ๐—ป๐—ฎ๐—ฟ๐˜† ๐——๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—บ๐—ฒ๐—ป๐˜: Gradually rolling out the new version to a small subset of users before a full deployment.

    ๐—ค. ๐—ฅ๐—ผ๐—น๐—น๐—ถ๐—ป๐—ด ๐——๐—ฒ๐—ฝ๐—น๐—ผ๐˜†๐—บ๐—ฒ๐—ป๐˜: Incrementally updating instances or servers with the new version, ensuring at least some instances are always running the old version.

    ๐—ค. ๐——๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฏ๐—ฒ ๐—ฎ ๐˜€๐—ถ๐˜๐˜‚๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐˜„๐—ต๐—ฒ๐—ฟ๐—ฒ ๐˜๐—ต๐—ฒ ๐—ฒ๐—ป๐˜๐—ถ๐—ฟ๐—ฒ ๐—ฝ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜๐—ถ๐—ผ๐—ป ๐—ถ๐—ป๐˜€๐˜๐—ฎ๐—ป๐—ฐ๐—ฒ ๐—ฐ๐—ฟ๐—ฎ๐˜€๐—ต๐—ฒ๐—ฑ, ๐—ฎ๐—ป๐—ฑ ๐˜†๐—ผ๐˜‚ ๐—ต๐—ฎ๐—ฑ ๐˜๐—ผ ๐—ณ๐—ถ๐˜… ๐—ถ๐˜ ๐—พ๐˜‚๐—ถ๐—ฐ๐—ธ๐—น๐˜†.
    In one instance, our production server crashed due to a
    memory leak in the application. I quickly identified the issue using monitoring tools like Prometheus and logs from ELK Stack.
    To resolve it, I restarted the affected services and temporarily scaled up the infrastructure to handle the load. I then worked with the development team to identify and fix the memory leak, ensuring it didnโ€™t happen again.

    ๐—ค.๐—–๐—น๐—ผ๐˜‚๐—ฑ ๐—ก๐—”๐—ง ๐—š๐—ฎ๐˜๐—ฒ๐˜„๐—ฎ๐˜†:
    Provides outbound internet access for instances in a private network without exposing them to inbound traffic.
    Used for secure, private instances that need internet access without being directly accessible from the internet.

    ๐—ค. ๐—ฉ๐—ฃ๐—– ๐—ฃ๐—ฒ๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด: A network connection between two VPCs that allows traffic to be routed between them using private IP addresses. This is useful for connecting resources across different VPCs without going over the public internet.

    ๐—ค. ๐—›๐—ฎ๐—ป๐—ฑ๐—น๐—ถ๐—ป๐—ด ๐— ๐˜‚๐—น๐˜๐—ถ๐—ฝ๐—น๐—ฒ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ๐˜€: Use Kubernetes namespaces to isolate microservices, and manage their deployment using Helm charts or a CI/CD tool like Jenkins, ArgoCD, or GitLab CI/CD. Implement service discovery, networking, and security policies to ensure seamless communication between microservices.

    ๐—ค. ๐—›๐—ฎ๐˜ƒ๐—ฒ ๐˜†๐—ผ๐˜‚ ๐˜„๐—ผ๐—ฟ๐—ธ๐—ฒ๐—ฑ ๐˜„๐—ถ๐˜๐—ต ๐—”๐˜‚๐˜๐—ผ ๐—ฆ๐—ฐ๐—ฎ๐—น๐—ถ๐—ป๐—ด ๐—š๐—ฟ๐—ผ๐˜‚๐—ฝ๐˜€ (๐—”๐—ฆ๐—š)?
    Yes, I have worked with ASGs to automatically scale the number of instances in response to demand. ASGs are configured with policies that adjust the desired capacity based on metrics such as CPU utilization, helping to maintain application performance and optimize costs.

  3. Member-only story

    Kubernetes Troubleshooting โ€”Understanding ImagePullBackOff (The Right Way!)

    One of the first errors most beginners encounter (and even experienced engineers sometimes dread) in Kubernetes Cluster is:

    ๐Ÿšจ ImagePullBackOff

    Sounds scary? Itโ€™s actually not โ€” once you understand whatโ€™s going on.

    In this post, Iโ€™ll walk you through what this error means, how to reproduce it on your local cluster, and most importantly, how to fix it โ€” whether itโ€™s caused by a bad image name, a private registry, or a simple copy-paste mistake.

    What Is ImagePullBackOff in Kubernetes?

    The name says it all โ€” this error is related to pulling a container image in your Kubernetes cluster. When you deploy a pod (whether through a Pod, Deployment, StatefulSet, etc.), Kubernetes needs to pull the container image from a registry like Docker Hub, ECR, or ACR.

    When that fails for any reason, Kubernetes throws this error.

    Thatโ€™s where the name comes from:

    • ImagePull: Kubernetes is trying to download the image.

    • BackOff: It's backing off between retries.

Put them together: ImagePullBackOff.

Two Common Scenarios That Cause ImagePullBackOff

Scenario 1: Invalid or Non-Existent Image Name

Letโ€™s say you meant to use the image nginx:1.14.2, but you accidentally typed:

    image: ngiNY:1.14.2  # typo!

That image doesnโ€™t exist on Docker Hub (or anywhere). Kubernetes will try to pull it, fail, and eventually hit ImagePullBackOff.

The same goes for specifying the wrong tag. If foolapp:1.1.1 was deleted from your registry, referencing it will cause the same error.

Scenario 2: Private Images Without Access

Letโ€™s say youโ€™re trying to pull an image from your private Docker Hub repo or ECR.

Unless Kubernetes has the right credentials, it wonโ€™t be able to access that image. That leads to โ€” you guessed it โ€” ImagePullBackOff.

Letโ€™s Solve ImagePullBackOff (The Fun Part)

If you want to play around with this error and troubleshoot it yourself:

  1. Start a local cluster with Minikube or at KillerCoda.

  2. Create a deployment with a non-existent image:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - name: nginx
            image: ngiNY:1.14.2  # <-- typo on purpose
    kubectl apply -f nginx-deploy.yaml
    kubectl get pods -w

Youโ€™ll first see ErrImagePull, and after a few retries, Kubernetes will enter ImagePullBackOff.

What Does โ€œBackOffโ€ Mean in Kubernetes?

Kubernetes doesnโ€™t give up easily.

When an image pull fails, it waits a bit and retries. If it fails again, it waits a little longer, and so on.

That increasing delay between retries is called backoff โ€” hence the term ImagePullBackOff.

Itโ€™s a retry loop, where the interval increases exponentially to avoid hammering the registry unnecessarily.

How to Troubleshoot

Here are a few simple but powerful commands to troubleshoot image pull errors:

Check Events of Pods in detail in Kubernetes Cluster

    kubectl describe pod <pod-name>

This gives you the exact reason why the image couldnโ€™t be pulled โ€” wrong name, unauthorized access, etc.

Watch Status of Pods

    kubectl get pods -w

This keeps you updated on the status of the pod in real time.

Fixing Private Image Pull Issues (The Right Way)

If your image is in a private repo, Kubernetes needs a secret to access it.

Step 1: Create a Docker Registry Secret

    kubectl create secret docker-registry demo-secret \
      --docker-username=<your-username> \
      --docker-password=<your-password> \
      --docker-email=<your-email> \
      --docker-server=https://index.docker.io/v1/

For AWS ECR or Azure, change the docker-server accordingly.

Step 2: Reference the Secret in Your YAML

    spec:
      imagePullSecrets:
        - name: demo-secret

Kubernetes now knows how to authenticate and pull your private image.

Recap: When You See ImagePullBackOffโ€ฆ

  1. Check your image name โ€” typos and wrong tags are super common.

  2. Is the image private? โ€” use imagePullSecrets to fix auth issues.

  3. Use kubectl describe pod to get the real reason.

  4. BackOff means retry loop โ€” Kubernetes is trying its best for you

Your Kubernetes Troubleshooting Toolkit

Here are some go-to commands always useful for me:

    kubectl get pods -w         # live watch
    kubectl describe pod <pod>  # detailed debug info
    kubectl get events          # useful for checking what Kubernetes is doing

And if youโ€™re ever stuck, this kubectl cheat sheet is your best friend.

Bonus: Pulling from AWS ECR

Pulling from AWS ECR if working with AWS Cloud? Itโ€™s the same concept โ€” just with a different --docker-server and a special command to get your token:

    aws ecr get-login-password | kubectl create secret docker-registry ecr-secret \
      --docker-server=<your-registry-url> \
      --docker-username=AWS \
      --docker-password-stdi

Update your deployment just like before to reference ecr-secret.

Pro Tips: Remember for ImagePullBackOff

  • Always double-check your image name and tag before deploying.

  • Use kubectl describe to get clear info on what went wrong.

  • Remember, ImagePullBackOff usually starts as ErrImagePull โ€” it just means Kubernetes is retrying.

Wrapping Up

ImagePullBackOff = Either your image doesnโ€™t exist, or you donโ€™t have access to it.

Fixing it is usually a matter of checking names, tags, or credentials. Simple โ€” once you know what to look for.

  1. ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐—ค๐˜‚๐—ฒ๐˜€๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐—ณ๐—ผ๐—ฟ ๐—Ÿ๐—ถ๐—ป๐˜‚๐˜… / ๐——๐—ฒ๐˜ƒ๐—ข๐—ฝ๐˜€ ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ hashtag#MustCheck

    ๐Ÿญ. ๐—จ๐˜€๐—ฒ๐—ฟ ๐—ฟ๏ฟฝ
    ๏ฟฝ๐—ฝ๐—ผ๐—ฟ๐˜๐˜€ ๐—ต๐—ถ๐—ด๐—ต ๐—–๐—ฃ๐—จ ๐˜‚๐˜€๐—ฎ๐—ด๐—ฒ. ๐—ช๐—ต๐—ฎ๐˜ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฑ๐—ผ?
    ๐—ฆ๐˜๐—ฒ๐—ฝ๐˜€:
    โ€ข Run top or htop to see real-time CPU usage.
    โ€ข Use ps aux --sort=-%cpu | head to find the top processes.
    โ€ข Investigate the PID using strace -p <pid> or lsof -p <pid>.

    Check if itโ€™s a normal load (e.g., backup, cron job) or a runaway process.

    ๐Ÿฎ. ๐——๐—ถ๐˜€๐—ธ ๐˜€๐—ฝ๐—ฎ๐—ฐ๐—ฒ ๐—ถ๐˜€ ๐—ณ๐˜‚๐—น๐—น. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐˜๐—ฟ๐—ผ๐˜‚๐—ฏ๐—น๐—ฒ๐˜€๐—ต๐—ผ๐—ผ๐˜ ๐—ฎ๐—ป๐—ฑ ๐—ณ๐—ถ๐˜… ๐—ถ๐˜?๐—ฆ๐˜๐—ฒ๐—ฝ๐˜€:
    โ€ข Run df -h to find which partition is full.
    โ€ข Use du -sh /* and then du -sh /var/* etc. to drill down.
    โ€ข Check /var/log/, /tmp, large files with find / -size +500M.

    Clean up logs, old files, or move/archive if needed.

    ๐Ÿฏ. ๐—ฌ๐—ผ๐˜‚ ๐—ฐ๐—ฎ๐—ป'๐˜ ๐—ฆ๐—ฆ๐—› ๐—ถ๐—ป๐˜๐—ผ ๐—ฎ ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ. ๐—ช๐—ต๐—ฎ๐˜ ๐—ฐ๐—ผ๐˜‚๐—น๐—ฑ ๐—ฏ๐—ฒ ๐˜๐—ต๐—ฒ ๐—ถ๐˜€๐˜€๐˜‚๐—ฒ?๐—–๐—ต๐—ฒ๐—ฐ๐—ธ๐˜€:
    โ€ข Network: ping server_ip, traceroute.
    โ€ข Port: nc -zv server_ip 22 or telnet server_ip 22.
    โ€ข Firewall: Check iptables, firewalld, security groups (cloud).
    โ€ข Service: Is sshd running? systemctl status sshd

    Auth: Are permissions on ~/.ssh/authorized_keys correct?

    ๐Ÿฐ. ๐—” ๐˜‚๐˜€๐—ฒ๐—ฟ ๐—ฐ๐—ฎ๐—ปโ€™๐˜ ๐—ฟ๐˜‚๐—ป ๐˜€๐˜‚๐—ฑ๐—ผ. ๐—ช๐—ต๐—ฎ๐˜ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฐ๐—ต๐—ฒ๐—ฐ๐—ธ?๐—ฆ๐˜๐—ฒ๐—ฝ๐˜€:
    โ€ข Check with groups username โ€” is the user in sudo group?
    โ€ข Check /etc/sudoers and /etc/sudoers.d/.
    โ€ข Use sudo -l -U username to list allowed sudo commands.

    Check /etc/passwd and /etc/shadow for account issues.

    ๐Ÿฑ. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ด๐—ถ๐˜ƒ๐—ฒ ๐—ฎ ๐˜‚๐˜€๐—ฒ๐—ฟ ๐—ฝ๐—ฒ๐—ฟ๐—บ๐—ถ๐˜€๐˜€๐—ถ๐—ผ๐—ป ๐˜๐—ผ ๐—ฟ๐˜‚๐—ป ๐—ผ๐—ป๐—น๐˜† ๐—ผ๐—ป๐—ฒ ๐—ฐ๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ ๐˜„๐—ถ๐˜๐—ต ๐˜€๐˜‚๐—ฑ๐—ผ?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ:
    Edit sudoers with visudo:
    username ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart apache2

    This allows only restarting Apache with sudo.

    ๐Ÿฒ. ๐—ง๐—ต๐—ฒ ๐˜„๐—ฒ๐—ฏ๐˜€๐—ถ๐˜๐—ฒ ๐—ต๐—ผ๐˜€๐˜๐—ฒ๐—ฑ ๐—ผ๐—ป ๐˜†๐—ผ๐˜‚๐—ฟ ๐—Ÿ๐—ถ๐—ป๐˜‚๐˜… ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ ๐—ถ๐˜€ ๐—ฑ๐—ผ๐˜„๐—ป. ๐—ช๐—ต๐—ฎ๐˜ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฐ๐—ต๐—ฒ๐—ฐ๐—ธ?๐—–๐—ต๐—ฒ๐—ฐ๐—ธ๐—น๐—ถ๐˜€๐˜:
    โ€ข Ping the server.
    โ€ข Check systemctl status apache2 or nginx.
    โ€ข Confirm the port is open: netstat -tuln | grep 80
    โ€ข Check firewall: ufw status, iptables -L.

    Check logs: /var/log/nginx/error.log or /var/log/apache2/error.log

    ๐Ÿณ. ๐—ก๐—ฒ๐˜๐˜„๐—ผ๐—ฟ๐—ธ ๐—ถ๐˜€ ๐˜€๐—น๐—ผ๐˜„. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฑ๐—ถ๐—ฎ๐—ด๐—ป๐—ผ๐˜€๐—ฒ ๐—ถ๐˜?๐—ง๐—ผ๐—ผ๐—น๐˜€:
    โ€ข ping, traceroute, mtr โ€” path and packet loss.
    โ€ข iftop, nload โ€” bandwidth usage.
    โ€ข ss -tuln โ€” open ports and connections.
    โ€ข Look for high RX/TX errors: ifconfig or ip -s link.

    โ€ข ๐Ÿด. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ถ๐—ป๐—ฑ ๐—ผ๐˜‚๐˜ ๐˜„๐—ต๐—ถ๐—ฐ๐—ต ๐—ฝ๐—ฟ๐—ผ๐—ฐ๐—ฒ๐˜€๐˜€ ๐—ถ๐˜€ ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐—ฎ ๐˜€๐—ฝ๐—ฒ๐—ฐ๐—ถ๐—ณ๐—ถ๐—ฐ ๐—ฝ๐—ผ๐—ฟ๐˜?
    sudo lsof -i :<port>sudo netstat -tulnp | grep <port>

    ๐Ÿต. ๐—” ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ ๐—ณ๐—ฎ๐—ถ๐—น๐˜€ ๐˜๐—ผ ๐˜€๐˜๐—ฎ๐—ฟ๐˜. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฑ๐—ฒ๐—ฏ๐˜‚๐—ด ๐—ถ๐˜?
    โ€ข systemctl status servicename
    โ€ข journalctl -xe for system logs
    โ€ข Check config syntax: nginx -t, named-checkconf, etc.
    Check port conflicts: netstat -tuln

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐˜ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ณ๐—ถ๐—น๐—ฒ๐˜€?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ง๐˜ฎ๐˜ต

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐˜‚๐˜€๐—ฒ ๐˜€๐—ฒ๐—ป๐˜€๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฑ๐—ฎ๐˜๐—ฎ ๐—น๐—ถ๐—ธ๐—ฒ ๐—ฐ๐—ฟ๐—ฒ๐—ฑ๐—ฒ๐—ป๐˜๐—ถ๐—ฎ๐—น๐˜€ ๐—ถ๐—ป ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ?

    Sensitive data can be managed securely in Terraform using environment variables, secret management tools, or Terraform variables with the sensitive attribute. Avoid hardcoding sensitive values in .tf files. Tools like HashiCorp Vault or AWS Secrets Manager can store and retrieve credentials. Secure your state file as it may contain sensitive outputs. Use .gitignore to exclude sensitive files from version control.

  2. ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐˜ƒ๐—ฎ๐—น๐—ถ๐—ฑ๐—ฎ๐˜๐—ฒ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ณ๐—ถ๐—น๐—ฒ๐˜€?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ท๐˜ข๐˜ญ๐˜ช๐˜ฅ๐˜ข๐˜ต๐˜ฆ

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—น๐—ถ๐˜€๐˜ ๐—ฎ๐—น๐—น ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐˜„๐—ผ๐—ฟ๐—ธ๐˜€๐—ฝ๐—ฎ๐—ฐ๐—ฒ๐˜€?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ๐˜ด๐˜ฑ๐˜ข๐˜ค๐˜ฆ ๐˜ญ๐˜ช๐˜ด๐˜ต

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฟ๐—ฒ๐—บ๐—ผ๐˜ƒ๐—ฒ ๐—ฎ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ ๐˜„๐—ถ๐˜๐—ต๐—ผ๐˜‚๐˜ ๐—ฑ๐—ฒ๐—น๐—ฒ๐˜๐—ถ๐—ป๐—ด ๐—ถ๐˜ ๐—ณ๐—ฟ๐—ผ๐—บ ๐˜๐—ต๐—ฒ ๐—ถ๐—ป๐—ณ๐—ฟ๐—ฎ๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ด๐˜ต๐˜ข๐˜ต๐˜ฆ ๐˜ณ๐˜ฎ <๐˜ณ๐˜ฆ๐˜ด๐˜ฐ๐˜ถ๐˜ณ๐˜ค๐˜ฆ_๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ>

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฐ๐—ฟ๐—ฒ๐—ฎ๐˜๐—ฒ ๐—ฎ ๐—ป๐—ฒ๐˜„ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐˜„๐—ผ๐—ฟ๐—ธ๐˜€๐—ฝ๐—ฎ๐—ฐ๐—ฒ?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ๐˜ด๐˜ฑ๐˜ข๐˜ค๐˜ฆ ๐˜ฏ๐˜ฆ๐˜ธ <๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ๐˜ด๐˜ฑ๐˜ข๐˜ค๐˜ฆ_๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ>

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ฟ๐—ฒ๐—ณ๐—ฟ๐—ฒ๐˜€๐—ต ๐˜๐—ต๐—ฒ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐˜€๐˜๐—ฎ๐˜๐—ฒ ๐—ณ๐—ถ๐—น๐—ฒ ๐˜„๐—ถ๐˜๐—ต ๐˜๐—ต๐—ฒ ๐—ฐ๐˜‚๐—ฟ๐—ฟ๐—ฒ๐—ป๐˜ ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ ๐˜€๐˜๐—ฎ๐˜๐—ฒ๐˜€?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ณ๐˜ฆ๐˜ง๐˜ณ๐˜ฆ๐˜ด๐˜ฉ

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—น๐—ผ๐—ฐ๐—ธ ๐˜๐—ต๐—ฒ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐˜€๐˜๐—ฎ๐˜๐—ฒ ๐—ณ๐—ถ๐—น๐—ฒ?
    State locking is enabled by default in remote backends like S3 with DynamoDB. Ensure your backend configuration supports locking. But now you can do state locking with just S3 and dynamoDB is not required.

    ๐—ค. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐˜€๐˜„๐—ถ๐˜๐—ฐ๐—ต ๐—ฏ๐—ฒ๐˜๐˜„๐—ฒ๐—ฒ๐—ป ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐˜„๐—ผ๐—ฟ๐—ธ๐˜€๐—ฝ๐—ฎ๐—ฐ๐—ฒ๐˜€?
    ๐˜ต๐˜ฆ๐˜ณ๐˜ณ๐˜ข๐˜ง๐˜ฐ๐˜ณ๐˜ฎ ๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ๐˜ด๐˜ฑ๐˜ข๐˜ค๐˜ฆ ๐˜ด๐˜ฆ๐˜ญ๐˜ฆ๐˜ค๐˜ต <๐˜ธ๐˜ฐ๐˜ณ๐˜ฌ๐˜ด๐˜ฑ๐˜ข๐˜ค๐˜ฆ_๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ>

  3. ๐—ค1. ๐—›๐—ผ๐˜„ ๐—ต๐—ฎ๐˜ƒ๐—ฒ ๐˜†๐—ผ๐˜‚ ๐—ถ๐—ป๐—ท๐—ฒ๐—ฐ๐˜๐—ฒ๐—ฑ ๐˜๐—ต๐—ฒ ๐˜€๐—ฒ๐—ฐ๐—ฟ๐—ฒ๐˜๐˜€ ๐—ถ๐—ป ๐—–๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐— ๐—ฎ๐—ฝ๐˜€?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ: Secrets should not be injected in ConfigMaps as ConfigMaps are not designed for sensitive data. Instead, Kubernetes Secrets should be used. Secrets can be injected into pods via environment variables or mounted as files.

    ๐—ค2. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ณ๐—ถ๐—ป๐—ฑ ๐˜„๐—ต๐—ถ๐—ฐ๐—ต ๐—ฝ๐—ผ๐—ฑ ๐—ถ๐˜€ ๐˜๐—ฎ๐—ธ๐—ถ๐—ป๐—ด ๐—บ๐—ผ๐—ฟ๐—ฒ ๐˜€๐˜†๐˜€๐˜๐—ฒ๐—บ ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ฎ๐—ฐ๐—ฟ๐—ผ๐˜€๐˜€ ๐—ป๐—ผ๐—ฑ๐—ฒ๐˜€ ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐—ธ๐˜‚๐—ฏ๐—ฒ๐—ฐ๐˜๐—น?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ: Use ๐˜ฌ๐˜ถ๐˜ฃ๐˜ฆ๐˜ค๐˜ต๐˜ญ ๐˜ต๐˜ฐ๐˜ฑ ๐˜ฑ๐˜ฐ๐˜ฅ --๐˜ข๐˜ญ๐˜ญ-๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ๐˜ด๐˜ฑ๐˜ข๐˜ค๐˜ฆ๐˜ด to list resource usage by pods.
    Combine it with ๐˜ฌ๐˜ถ๐˜ฃ๐˜ฆ๐˜ค๐˜ต๐˜ญ ๐˜ฅ๐˜ฆ๐˜ด๐˜ค๐˜ณ๐˜ช๐˜ฃ๐˜ฆ ๐˜ฑ๐˜ฐ๐˜ฅ <๐˜ฑ๐˜ฐ๐˜ฅ-๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ> to get detailed resource usage.

    ๐—ค3. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ธ๐—ป๐—ผ๐˜„ ๐˜„๐—ต๐—ถ๐—ฐ๐—ต ๐˜„๐—ผ๐—ฟ๐—ธ๐—ฒ๐—ฟ ๐—ป๐—ผ๐—ฑ๐—ฒ ๐—ถ๐˜€ ๐—ฐ๐—ผ๐—ป๐˜€๐˜‚๐—บ๐—ถ๐—ป๐—ด ๐—บ๐—ผ๐—ฟ๐—ฒ ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ฎ๐—ฐ๐—ฟ๐—ผ๐˜€๐˜€ ๐˜๐—ต๐—ฒ ๐—ฐ๐—น๐˜‚๐˜€๐˜๐—ฒ๐—ฟ๐˜€ ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐—ธ๐˜‚๐—ฏ๐—ฒ๐—ฐ๐˜๐—น?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ: Use kubectl top nodes to see resource consumption across nodes. This will show CPU and memory usage on each node.

    ๐—ค4. ๐—ช๐—ต๐—ฎ๐˜ ๐—ฎ๐—ฟ๐—ฒ ๐˜๐—ต๐—ฒ ๐˜€๐˜๐—ฒ๐—ฝ๐˜€ ๐—ณ๐—ผ๐—ฟ ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ถ๐—ป๐—ด ๐—ฃ๐—ฟ๐—ผ๐—บ๐—ฒ๐˜๐—ต๐—ฒ๐˜‚๐˜€ ๐—ฎ๐—ป๐—ฑ ๐—š๐—ฟ๐—ฎ๐—ณ๐—ฎ๐—ป๐—ฎ ๐—ณ๐—ผ๐—ฟ ๐—บ๐—ผ๐—ป๐—ถ๐˜๐—ผ๐—ฟ๐—ถ๐—ป๐—ด ๐—ž๐˜‚๐—ฏ๐—ฒ๐—ฟ๐—ป๐—ฒ๐˜๐—ฒ๐˜€ ๐—ฐ๐—น๐˜‚๐˜€๐˜๐—ฒ๐—ฟ๐˜€?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ:
    1. Deploy Prometheus using Helm or a custom YAML configuration.
    2. Set up Kubernetes service discovery for Prometheus.
    3. Deploy Grafana and configure it to use Prometheus as a data source.
    4. Import Kubernetes monitoring dashboards in Grafana.
    5. Set up alerting rules in Prometheus as needed.

    ๐—ค5. ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐˜€๐—ฒ๐˜€๐˜€๐—ถ๐—ผ๐—ป ๐—ฎ๐—ณ๐—ณ๐—ถ๐—ป๐—ถ๐˜๐˜†?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ: Session affinity, also known as sticky sessions, is a concept in load balancing where requests from a particular user are consistently directed to the same server (or pod) in a multi-server environment.
    This ensures that the user's session data, which might be stored locally on the server, remains accessible throughout the session.

    ๐—ค6. ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—ฝ๐—ผ๐—ฑ ๐—ฎ๐—ณ๐—ณ๐—ถ๐—ป๐—ถ๐˜๐˜† ๐—ฎ๐—ป๐—ฑ ๐—ถ๐˜๐˜€ ๐˜‚๐˜€๐—ฒ ๐—ฐ๐—ฎ๐˜€๐—ฒ?
    ๐—”๐—ป๐˜€๐˜„๐—ฒ๐—ฟ: Pod affinity is a feature in Kubernetes that allows you to specify rules for scheduling pods to run on
    nodes that have other specified pods running on them. This can be useful when you want certain
    pods to be located together due to factors like data locality, network latency, or shared resources.
    ๐—จ๐˜€๐—ฒ ๐—–๐—ฎ๐˜€๐—ฒ: An application where the frontend and backend services communicate frequently might
    use pod affinity to ensure that both are scheduled on the same node to reduce network latency.

  4. 1. ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—ฟ๐—ฒ๐—บ๐—ผ๐˜๐—ฒ ๐˜€๐˜๐—ฎ๐˜๐—ฒ ๐—ถ๐—ป ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ?
    Remote state in Terraform refers to storing the state file on a remote backend, such as Amazon S3, instead of locally. This facilitates collaboration and enables locking.

    2. ๐—›๐—ผ๐˜„ ๐—ฐ๐—ฎ๐—ป ๐˜†๐—ผ๐˜‚ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ ๐—บ๐˜‚๐—น๐˜๐—ถ๐—ฝ๐—น๐—ฒ ๐—ฒ๐—ป๐˜ƒ๐—ถ๐—ฟ๐—ผ๐—ป๐—บ๐—ฒ๐—ป๐˜๐˜€ (๐—ฑ๐—ฒ๐˜ƒ, ๐—ฝ๐—ฟ๐—ผ๐—ฑ) ๐˜„๐—ถ๐˜๐—ต ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ?
    You can use Terraform workspaces or create separate directories for each environment, each with its own state file and variables.

    3. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ ๐˜†๐—ผ๐˜‚ ๐—ต๐—ฎ๐—ป๐—ฑ๐—น๐—ฒ ๐—ฑ๐—ฒ๐—ฝ๐—ฒ๐—ป๐—ฑ๐—ฒ๐—ป๐—ฐ๐—ถ๐—ฒ๐˜€ ๐—ฏ๐—ฒ๐˜๐˜„๐—ฒ๐—ฒ๐—ป ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ถ๐—ป ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ?
    Terraform automatically handles dependencies based on the resource definitions in your configuration. It will create resources in the correct order.
    4. ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ'๐˜€ "๐—ฎ๐—ฝ๐—ฝ๐—น๐˜†" ๐—ฝ๐—ฟ๐—ผ๐—ฐ๐—ฒ๐˜€๐˜€?
    The "apply" process in Terraform involves comparing the desired state from your configuration to the current state, generating an execution plan, and then applying the changes.

    5. ๐—›๐—ผ๐˜„ ๐—ฐ๐—ฎ๐—ป ๐˜†๐—ผ๐˜‚ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ ๐˜ƒ๐—ฒ๐—ฟ๐˜€๐—ถ๐—ผ๐—ป๐—ถ๐—ป๐—ด ๐—ผ๐—ณ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด๐˜‚๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป๐˜€?
    You can use version control systems like Git to track changes to your Terraform configurations. Additionally, Terraform Cloud and Enterprise offer versioning features.

    6. ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐˜๐—ต๐—ฒ ๐—ฑ๐—ถ๐—ณ๐—ณ๐—ฒ๐—ฟ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐—ฏ๐—ฒ๐˜๐˜„๐—ฒ๐—ฒ๐—ป ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฎ๐—ป๐—ฑ ๐—–๐—น๐—ผ๐˜‚๐—ฑ๐—™๐—ผ๐—ฟ๐—บ๐—ฎ๐˜๐—ถ๐—ผ๐—ป?
    Terraform is a multi-cloud IaC tool that supports various cloud providers, including AWS. CloudFormation is AWS-specific and focuses on AWS resource provisioning.

    7. ๐—ช๐—ต๐—ฎ๐˜ ๐—ถ๐˜€ ๐—ฎ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—บ๐—ผ๐—ฑ๐˜‚๐—น๐—ฒ?
    A Terraform module is a reusable set of configurations that can be used to create multiple resources with a consistent configuration.

    8. ๐—›๐—ผ๐˜„ ๐—ฐ๐—ฎ๐—ป ๐˜†๐—ผ๐˜‚ ๐—ฑ๐—ฒ๐˜€๐˜๐—ฟ๐—ผ๐˜† ๐—ถ๐—ป๐—ณ๐—ฟ๐—ฎ๐˜€๐˜๐—ฟ๐˜‚๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ ๐—ฐ๐—ฟ๐—ฒ๐—ฎ๐˜๐—ฒ๐—ฑ ๐—ฏ๐˜† ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ?
    You can use the terraform destroy command to remove all resources defined in your Terraform configuration.

    9. ๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ๐—ฒ๐˜€ ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ฒ ๐˜‚๐—ฝ๐—ฑ๐—ฎ๐˜๐—ฒ๐˜€ ๐˜๐—ผ ๐—ฒ๐˜…๐—ถ๐˜€๐˜๐—ถ๐—ป๐—ด ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€?
    Terraform applies updates by modifying existing resources rather than recreating them. This helps preserve data and configurations.

    10. ๐—–๐—ฎ๐—ป ๐—ง๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—ณ๐—ผ๐—ฟ๐—บ ๐—ฏ๐—ฒ ๐˜‚๐˜€๐—ฒ๐—ฑ ๐—ณ๐—ผ๐—ฟ ๐—บ๐—ฎ๐—ป๐—ฎ๐—ด๐—ถ๐—ป๐—ด ๐˜๐—ต๐—ถ๐—ฟ๐—ฑ-๐—ฝ๐—ฎ๐—ฟ๐˜๐˜† ๐—ฟ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€?
    Yes, Terraform has the capability to manage resources beyond AWS. It supports multiple providers, making it versatile for managing various cloud and on-premises resources.