Skip to content

Commit

Permalink
fix: add resources limits to avoid eviction
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Nov 25, 2020
1 parent c5e31b5 commit a9747b3
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 53 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,35 @@ kind-init:
kind delete cluster --name=kube-ovn
kube_proxy_mode=ipvs ip_family=ipv4 ha=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml
kind create cluster --config yamls/kind.yaml --name kube-ovn
kubectl get no -o wide
kubectl describe no
docker exec kube-ovn-control-plane ip link add link eth0 mac1 type macvlan
docker exec kube-ovn-worker ip link add link eth0 mac1 type macvlan

kind-init-iptables:
kind delete cluster --name=kube-ovn
kube_proxy_mode=iptables ip_family=ipv4 ha=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml
kind create cluster --config yamls/kind.yaml --name kube-ovn
kubectl get no -o wide
kubectl describe no
docker exec kube-ovn-control-plane ip link add link eth0 mac1 type macvlan
docker exec kube-ovn-worker ip link add link eth0 mac1 type macvlan

kind-install:
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
ENABLE_SSL=true dist/images/install.sh
kubectl get no -o wide
kubectl describe no

kind-init-ha:
kind delete cluster --name=kube-ovn
kube_proxy_mode=ipvs ip_family=ipv4 ha=true j2 yamls/kind.yaml.j2 -o yamls/kind.yaml
kind create cluster --config yamls/kind.yaml --name kube-ovn
kubectl get no -o wide
kubectl describe no

kind-init-ipv6:
kind delete cluster --name=kube-ovn
kube_proxy_mode=iptables ip_family=ipv6 ha=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml
kind create cluster --config yamls/kind.yaml --name kube-ovn
kubectl get no -o wide
kubectl describe no

kind-install-ipv6:
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
Expand Down
119 changes: 86 additions & 33 deletions dist/images/install-pre-1.16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ VLAN_RANGE="1,4095"
DPDK="false"
DPDK_SUPPORTED_VERSIONS=("19.11")
DPDK_VERSION=""
DPDK_CPU="1000m" # Default CPU configuration for if --dpdk-cpu flag is not included
DPDK_MEMORY="2Gi" # Default Memory configuration for it --dpdk-memory flag is not included

display_help() {
echo "Usage: $0 [option...]"
echo
echo " -h, --help Print Help (this message) and exit"
echo " --with-dpdk=<version> Install Kube-OVN with OVS-DPDK instead of kernel OVS"
echo " --dpdk-cpu=<amount>m Configure DPDK to use a specific amount of CPU"
echo " --dpdk-memory=<amount>Gi Configure DPDK to use a specific amount of memory"
echo
exit 0
}
Expand All @@ -65,6 +69,26 @@ then
exit 1
fi
;;
--dpdk-cpu=*)
DPDK_CPU="${1#*=}"
if [[ $DPDK_CPU =~ ^[0-9]+(m)$ ]]
then
echo "CPU $DPDK_CPU"
else
echo "$DPDK_CPU is not valid, please use the format --dpdk-cpu=<amount>m"
exit 1
fi
;;
--dpdk-memory=*)
DPDK_MEMORY="${1#*=}"
if [[ $DPDK_MEMORY =~ ^[0-9]+(Gi)$ ]]
then
echo "MEMORY $DPDK_MEMORY"
else
echo "$DPDK_MEMORY is not valid, please use the format --dpdk-memory=<amount>Gi"
exit 1
fi
;;
-?*)
echo "Unknown argument $1"
exit 1
Expand Down Expand Up @@ -455,7 +479,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ovn
namespace: kube-system
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -530,14 +554,14 @@ roleRef:
subjects:
- kind: ServiceAccount
name: ovn
namespace: kube-system
namespace: kube-system
---
kind: Service
apiVersion: v1
metadata:
name: ovn-nb
namespace: kube-system
namespace: kube-system
spec:
ports:
- name: ovn-nb
Expand All @@ -555,7 +579,7 @@ kind: Service
apiVersion: v1
metadata:
name: ovn-sb
namespace: kube-system
namespace: kube-system
spec:
ports:
- name: ovn-sb
Expand All @@ -573,7 +597,7 @@ kind: Service
apiVersion: v1
metadata:
name: kube-ovn-monitor
namespace: kube-system
namespace: kube-system
labels:
app: kube-ovn-monitor
spec:
Expand All @@ -589,7 +613,7 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: ovn-central
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
OVN components: northd, nb and sb.
Expand Down Expand Up @@ -650,8 +674,11 @@ spec:
fieldPath: metadata.namespace
resources:
requests:
cpu: 500m
cpu: 300m
memory: 300Mi
limits:
cpu: 3
memory: 3Gi
volumeMounts:
- mountPath: /var/run/openvswitch
name: host-run-ovs
Expand Down Expand Up @@ -709,8 +736,11 @@ spec:
fieldPath: metadata.namespace
resources:
requests:
cpu: 500m
memory: 300Mi
cpu: 200m
memory: 200Mi
limits:
cpu: 200m
memory: 200Mi
volumeMounts:
- mountPath: /var/run/openvswitch
name: host-run-ovs
Expand Down Expand Up @@ -780,7 +810,7 @@ kind: DaemonSet
apiVersion: apps/v1
metadata:
name: ovs-ovn
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
This daemon set launches the openvswitch daemon.
Expand Down Expand Up @@ -865,11 +895,11 @@ spec:
timeoutSeconds: 45
resources:
requests:
cpu: 500m
memory: 2Gi
cpu: $DPDK_CPU
memory: $DPDK_MEMORY
limits:
cpu: 1000m
memory: 2Gi
cpu: $DPDK_CPU
memory: $DPDK_MEMORY
hugepages-1Gi: 1Gi
nodeSelector:
kubernetes.io/os: "linux"
Expand Down Expand Up @@ -953,7 +983,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: ovn
namespace: kube-system
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -970,6 +1000,8 @@ rules:
- apiGroups:
- "kubeovn.io"
resources:
- vpcs
- vpcs/status
- subnets
- subnets/status
- ips
Expand Down Expand Up @@ -1027,13 +1059,13 @@ roleRef:
subjects:
- kind: ServiceAccount
name: ovn
namespace: kube-system
namespace: kube-system
---
kind: Service
apiVersion: v1
metadata:
name: ovn-nb
namespace: kube-system
namespace: kube-system
spec:
ports:
- name: ovn-nb
Expand All @@ -1050,7 +1082,7 @@ kind: Service
apiVersion: v1
metadata:
name: ovn-sb
namespace: kube-system
namespace: kube-system
spec:
ports:
- name: ovn-sb
Expand All @@ -1067,7 +1099,7 @@ kind: Service
apiVersion: v1
metadata:
name: kube-ovn-monitor
namespace: kube-system
namespace: kube-system
labels:
app: kube-ovn-monitor
spec:
Expand All @@ -1083,7 +1115,7 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: ovn-central
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
OVN components: northd, nb and sb.
Expand Down Expand Up @@ -1144,8 +1176,11 @@ spec:
fieldPath: metadata.namespace
resources:
requests:
cpu: 500m
memory: 300Mi
cpu: 300m
memory: 200Mi
limits:
cpu: 3
memory: 3Gi
volumeMounts:
- mountPath: /var/run/openvswitch
name: host-run-ovs
Expand Down Expand Up @@ -1203,8 +1238,11 @@ spec:
fieldPath: metadata.namespace
resources:
requests:
cpu: 500m
memory: 300Mi
cpu: 200m
memory: 200Mi
limits:
cpu: 200m
memory: 200Mi
volumeMounts:
- mountPath: /var/run/openvswitch
name: host-run-ovs
Expand Down Expand Up @@ -1273,7 +1311,7 @@ kind: DaemonSet
apiVersion: apps/v1
metadata:
name: ovs-ovn
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
This daemon set launches the openvswitch daemon.
Expand Down Expand Up @@ -1357,7 +1395,7 @@ spec:
resources:
requests:
cpu: 200m
memory: 300Mi
memory: 200Mi
limits:
cpu: 1000m
memory: 800Mi
Expand Down Expand Up @@ -1409,7 +1447,7 @@ kind: Deployment
apiVersion: apps/v1
metadata:
name: kube-ovn-controller
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
kube-ovn controller
Expand Down Expand Up @@ -1489,6 +1527,13 @@ spec:
periodSeconds: 7
failureThreshold: 5
timeoutSeconds: 45
resources:
requests:
cpu: 200m
memory: 200Mi
limits:
cpu: 1000m
memory: 1Gi
nodeSelector:
kubernetes.io/os: "linux"
volumes:
Expand All @@ -1502,7 +1547,7 @@ kind: DaemonSet
apiVersion: apps/v1
metadata:
name: kube-ovn-cni
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
This daemon set launches the kube-ovn cni daemon.
Expand Down Expand Up @@ -1592,6 +1637,13 @@ spec:
initialDelaySeconds: 30
periodSeconds: 7
failureThreshold: 5
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 1000m
memory: 1Gi
nodeSelector:
kubernetes.io/os: "linux"
volumes:
Expand All @@ -1616,7 +1668,7 @@ kind: DaemonSet
apiVersion: apps/v1
metadata:
name: kube-ovn-pinger
namespace: kube-system
namespace: kube-system
annotations:
kubernetes.io/description: |
This daemon set launches the openvswitch daemon.
Expand Down Expand Up @@ -1688,7 +1740,7 @@ spec:
resources:
requests:
cpu: 100m
memory: 300Mi
memory: 100Mi
limits:
cpu: 200m
memory: 400Mi
Expand Down Expand Up @@ -1725,7 +1777,7 @@ kind: Service
apiVersion: v1
metadata:
name: kube-ovn-pinger
namespace: kube-system
namespace: kube-system
labels:
app: kube-ovn-pinger
spec:
Expand All @@ -1739,7 +1791,7 @@ kind: Service
apiVersion: v1
metadata:
name: kube-ovn-controller
namespace: kube-system
namespace: kube-system
labels:
app: kube-ovn-controller
spec:
Expand All @@ -1753,7 +1805,7 @@ kind: Service
apiVersion: v1
metadata:
name: kube-ovn-cni
namespace: kube-system
namespace: kube-system
labels:
app: kube-ovn-cni
spec:
Expand Down Expand Up @@ -1939,6 +1991,7 @@ vsctl(){
}
diagnose(){
kubectl get crd vpcs.kubeovn.io
kubectl get crd subnets.kubeovn.io
kubectl get crd ips.kubeovn.io
kubectl get svc kube-dns -n kube-system
Expand Down

0 comments on commit a9747b3

Please sign in to comment.