0% found this document useful (0 votes)
9 views

devops interview

The document provides detailed information on various aspects of Kubernetes, Jenkins, Docker, Terraform, and AWS services. It covers architecture components, deployment strategies, security practices, and observability tools. Additionally, it includes code snippets for Kubernetes deployment files, Dockerfiles, and Terraform configurations, along with troubleshooting steps for Jenkins and Terraform state management.

Uploaded by

poojanandish1993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

devops interview

The document provides detailed information on various aspects of Kubernetes, Jenkins, Docker, Terraform, and AWS services. It covers architecture components, deployment strategies, security practices, and observability tools. Additionally, it includes code snippets for Kubernetes deployment files, Dockerfiles, and Terraform configurations, along with troubleshooting steps for Jenkins and Terraform state management.

Uploaded by

poojanandish1993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Here are detailed answers to each of your questions:

1. Kubernetes Architecture
 Master Components:

o kube-apiserver: Entry point for all API requests.

o etcd: Key-value store (stores cluster state).

o kube-scheduler: Assigns Pods to nodes.

o kube-controller-manager: Manages controllers (ReplicaSet, Job,


etc.).

 Node Components:

o kubelet: Communicates with master and manages containers.

o kube-proxy: Handles networking/routing.

o Container runtime: e.g., containerd or Docker.

2. What is Ingress Controller?


An Ingress Controller is a Kubernetes component that:
 Manages external access to services (HTTP/HTTPS).

 Uses Ingress resources (rules for routing).

 Example controllers: NGINX Ingress, Traefik.

3. Jenkins Pipeline is Not Up — Reasons


 Jenkins master/agent down.

 Jenkinsfile syntax error.

 Git repo unreachable.

 Plugin conflict or corrupted Jenkins config.

 Disk space or memory issues.


4. Explain the Deployment File (K8s)
yamlCopyEditapiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app-container
image: my-image:latest
ports:
- containerPort: 80

5. Explain Dockerfile
DockerfileCopyEditFROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]

Build using docker build -t my-image .

6. How to Secure Kubernetes Cluster


 Role-Based Access Control (RBAC).

 Use Network Policies.

 Enable Audit Logs.

 Use TLS for all communication.

 Restrict access to etcd.


7. Self-Managed vs Cloud-Managed Cluster
Cloud-Managed (like EKS, AKS) is preferred:
 Pros: Easier maintenance, built-in monitoring, scalability.

 Cons: Less control.


Self-managed gives full control but more ops overhead.

8. Observability Tools Used


 Prometheus + Grafana

 ELK Stack (Elasticsearch, Logstash, Kibana)

 Datadog, New Relic

 CloudWatch for AWS

9. Secure Jenkins Data


 Use Credentials Plugin with encrypted secrets.

 Restrict access via RBAC.

 Enable HTTPS.

 Use Audit Trail Plugin.

10. Deployment Strategies


 Rolling Update: Update pods incrementally.

 Blue-Green: New version runs alongside, then switch traffic.

 Canary: Deploy to small % of users, monitor, then rollout.

 Recreate: Stop old, then start new.

11. Terraform Folder Structure


plaintextCopyEditterraform/

├── main.tf # Resource definitions
├── variables.tf # Input variables
├── outputs.tf # Output values
├── terraform.tfvars # Variable values
└── backend.tf # Remote backend config

12. What is Terraform State File? Where to Store?


 Tracks infrastructure created.

 Stored locally (terraform.tfstate) or remotely (e.g., S3 with


DynamoDB for locking).

13. Lock State File


Use DynamoDB locking in remote backend:
hclCopyEditbackend "s3" {
bucket = "my-tf-bucket"
key = "env/dev/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "terraform-locks"
encrypt = true
}

14. EC2 Changed Outside Terraform – What to Do?


 Run: terraform plan → detects drift.

 Run: terraform import aws_instance.example i-0abc123456def

 Follow up with terraform plan to validate.

15. What is terraform init?


 Initializes Terraform config.

 Downloads providers.

 Sets up backend.
16. CloudWatch Alarms & Auto Scaling
 Create Alarm on metric (e.g., CPU > 70%).

 Link to Auto Scaling policy.

 Trigger scale out/in actions.

 Done via Console, CLI, or Terraform.

17. Kubernetes Rollback


bashCopyEditkubectl rollout undo deployment <deployment-name>

18. Python Script to Reverse String


pythonCopyEdits = "hello world"
print(s[::-1]) # Output: "dlrow olleh"

Would you like a hands-on YAML or Terraform sample for any of these?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy