Sobes.tech
Junior

What resources can be used to create pods in Kubernetes?

sobes.tech AI

Answer from AI

  • Deployment
  • StatefulSet
  • DaemonSet
  • ReplicaSet
  • Job
  • CronJob
  • Manually, using kubectl apply -f pod.yaml or kubectl run
  • Custom Resources, defining their own controllers that create pods
# Example of creating a pod via Pod manifest
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: my-container
    image: nginx:latest
# Example of creating pods via Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 3 # Number of pods
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-container
        image: nginx:latest