Skip to content

Latest commit

 

History

History
44 lines (37 loc) · 758 Bytes

node-segregation.md

File metadata and controls

44 lines (37 loc) · 758 Bytes

Kubernetes Node Segregation

Node segregation

To segregate workloads, e.g. "UAT" and "Dev" so they don't share physical nodes:

  1. Label the nodes
# First list all your nodes
kubectl get nodes

# Next, label a particular node:
# kubectl label nodes <node-name> <label-key>=<label-value>
kubectl label nodes node0 env=dev
  1. Use nodeSelector in your deployments
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
      nodeSelector:
        env: dev