<p>Will minimal number of replicas higher than 1 set in one of the below code snippets in production environments increase resiliency and availability  (let's say starting with 2)?</p>
<p>What would be the best practices when setting this variable ?</p>
<p>I'm new to kubernetes but I was not able to find answer to this question.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: test
  namespace: test
  labels:
    app: test
spec:
  replicas: 1
</code></pre>
<p>...</p>
<pre><code>apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: test-hpa
  namespace: test
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: test
  minReplicas: 1
</code></pre>

cah1r
<p>The short answer is 'yes', but there are many cases where the answer would be 'no'. For instance of all instances of the pod are scheduled on the same node, and the node dies, there will be some downtime before the pods start up again on an available node.</p>
<p>You can configure topologySpreadConstraints based on topologyKey: &quot;node&quot; as documented here <a href="https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/</a> to raise your recilience level.</p>
