kubectl create sts code example

Example 1: kubernetes get statefulset

# Get pods in default namespace
kubectl get statefulsets

#Get Pods in my-namespace
kubectl get statefulsets -n my-namespace

#Get Pods in all namespaces
kubectl get statefulsets --all-namespaces

Example 2: kubernetes stateful set

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Tags:

Misc Example