apiVersion: apps/v1
kind: Deployment
metadata:
  name: sample
  labels:
    app: sample
spec:
  # hpaを使う場合replicasは指定しない(apply時にhpaが設定したpod数が上書きされてしまう)
  # 参考: https://github.com/kubernetes/kubernetes/issues/25238
  # replicas: 2
  selector:
    matchLabels:
      app: sample
  template:
    metadata:
      labels:
        app: sample
    spec:
      containers:
      - name: app
        image: sample
        ports:
        - containerPort: 8080
        # hpaがうまくpodをスケールさせるには制限が必要
        resources:
          limits:
            cpu: 150m
          requests:
            cpu: 150m
      # priorityは他のpod(主にkube-system上にある)と比べて低く設定
      priorityClassName: application
