From dcef2ff689dc1960358436d649eaa770107766a5 Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Sat, 8 Aug 2020 09:52:48 +0300 Subject: [PATCH 1/2] Update example for Resources Reservation --- docs/cluster_spec.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/cluster_spec.md b/docs/cluster_spec.md index a63602e7fc9f..8d559bd40cfd 100644 --- a/docs/cluster_spec.md +++ b/docs/cluster_spec.md @@ -647,25 +647,27 @@ For more information, see the [feature gate documentation](https://kubernetes.io ### Compute Resources Reservation +In a scenario where node has 32Gi of memory, 16 CPUs and 100Gi of ephemeral storage, resource reservation could be set as in the following example: + ```yaml spec: kubelet: kubeReserved: - cpu: "100m" - memory: "100Mi" + cpu: "1" + memory: "2Gi" ephemeral-storage: "1Gi" kubeReservedCgroup: "/kube-reserved" kubeletCgroups: "/kube-reserved" runtimeCgroups: "/kube-reserved" systemReserved: - cpu: "100m" - memory: "100Mi" + cpu: "500m" + memory: "1Gi" ephemeral-storage: "1Gi" systemReservedCgroup: "/system-reserved" enforceNodeAllocatable: "pods,system-reserved,kube-reserved" ``` -Will result in the flag `--kube-reserved=cpu=100m,memory=100Mi,ephemeral-storage=1Gi --kube-reserved-cgroup=/kube-reserved --kubelet-cgroups=/kube-reserved --runtime-cgroups=/kube-reserved --system-reserved=cpu=100m,memory=100Mi,ephemeral-storage=1Gi --system-reserved-cgroup=/system-reserved --enforce-node-allocatable=pods,system-reserved,kube-reserved` +The above will result in the flags `--kube-reserved=cpu=1,memory=2Gi,ephemeral-storage=1Gi --kube-reserved-cgroup=/kube-reserved --kubelet-cgroups=/kube-reserved --runtime-cgroups=/kube-reserved --system-reserved=cpu=500m,memory=1Gi,ephemeral-storage=1Gi --system-reserved-cgroup=/system-reserved --enforce-node-allocatable=pods,system-reserved,kube-reserved` being added to the kubelet. Learn more about reserving compute resources [here](https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/) and [here](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/). From f772c552e76db92d50a72176318a587d696621e3 Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Sat, 8 Aug 2020 09:55:15 +0300 Subject: [PATCH 2/2] Remove outdated docs for Calico --- .../create_migration_manifest.sh | 52 --------- docs/calico_cidr_migration/jobs.yaml.template | 108 ------------------ hack/.shellcheck_failures | 1 - 3 files changed, 161 deletions(-) delete mode 100755 docs/calico_cidr_migration/create_migration_manifest.sh delete mode 100644 docs/calico_cidr_migration/jobs.yaml.template diff --git a/docs/calico_cidr_migration/create_migration_manifest.sh b/docs/calico_cidr_migration/create_migration_manifest.sh deleted file mode 100755 index 66175ab18cf9..000000000000 --- a/docs/calico_cidr_migration/create_migration_manifest.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Copyright 2017 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -############################################################################### -# -# create_migration_manifest.sh -# -# Script that returns a templated Calico CIDR migration manifest file. -# -############################################################################### - -set -e - -command -v jq >/dev/null 2>&1 || { echo >&2 "jq is required to run this script."; exit 1; } -command -v kops >/dev/null 2>&1 || { echo >&2 "kops is required to run this script."; exit 1; } - -[ -z "$NAME" ] && echo "Please set NAME to the name of your cluster you wish to perform this migration against." && exit 1; - -export MIGRATION_TEMPLATE="jobs.yaml.template" -export MIGRATION_MANIFEST="jobs.yaml" -export NON_MASQUERADE_CIDR="`kops get cluster $NAME -o json --full | jq .spec.nonMasqueradeCIDR --raw-output`" -export POD_CIDR="`kops get cluster $NAME -o json --full | jq .spec.kubeControllerManager.clusterCIDR --raw-output`" -export IS_CROSS_SUBNET="`kops get cluster $NAME -o json --full | jq .spec.networking.calico.crossSubnet --raw-output`" - -cp ${MIGRATION_TEMPLATE} ${MIGRATION_MANIFEST} - -if [ "$IS_CROSS_SUBNET" = "true" ]; then - echo "ipip mode is set to 'cross-subnet'. Honouring in migration manifest." -else - echo "ipip mode is set to 'Always'. Honouring in migration manifest." - sed -i "/mode: cross-subnet/d" ${MIGRATION_MANIFEST} -fi - -sed -i -e "s@{{NON_MASQUERADE_CIDR}}@${NON_MASQUERADE_CIDR}@g" ${MIGRATION_MANIFEST} -sed -i -e "s@{{POD_CIDR}}@${POD_CIDR}@g" ${MIGRATION_MANIFEST} - -echo "jobs.yaml created. Please run: " -echo "kubectl apply -f jobs.yaml" diff --git a/docs/calico_cidr_migration/jobs.yaml.template b/docs/calico_cidr_migration/jobs.yaml.template deleted file mode 100644 index 0625685bfd9d..000000000000 --- a/docs/calico_cidr_migration/jobs.yaml.template +++ /dev/null @@ -1,108 +0,0 @@ -# This ConfigMap is used in the creation of a new Calico IP Pool. -kind: ConfigMap -apiVersion: v1 -metadata: - name: calico-config-ippool - namespace: kube-system -data: - # The default IP Pool to be created for the cluster. - # Pod IP addresses will be assigned from this pool. - ippool.yaml: | - apiVersion: v1 - kind: ipPool - metadata: - cidr: {{POD_CIDR}} - spec: - ipip: - enabled: true - mode: cross-subnet - nat-outgoing: true ---- -## This manifest deploys a Job which adds a new ippool to calico -apiVersion: batch/v1 -kind: Job -metadata: - name: configure-calico-ippool - namespace: kube-system - labels: - k8s-app: calico - role.kubernetes.io/networking: "1" -spec: - template: - metadata: - name: configure-calico-ippool - annotations: - scheduler.alpha.kubernetes.io/critical-pod: '' - spec: - hostNetwork: true - serviceAccountName: calico - tolerations: - - key: node-role.kubernetes.io/master - effect: NoSchedule - - key: CriticalAddonsOnly - operator: Exists - restartPolicy: OnFailure - containers: - - name: configure-calico - image: calico/ctl:v1.2.1 - args: - - apply - - -f - - /etc/config/calico/ippool.yaml - volumeMounts: - - name: config-volume - mountPath: /etc/config - env: - # The location of the etcd cluster. - - name: ETCD_ENDPOINTS - valueFrom: - configMapKeyRef: - name: calico-config - key: etcd_endpoints - volumes: - - name: config-volume - configMap: - name: calico-config-ippool - items: - - key: ippool.yaml - path: calico/ippool.yaml - ---- -## This manifest deploys a Job which deletes the old ippool from calico -apiVersion: batch/v1 -kind: Job -metadata: - name: configure-calico-ippool-remove - namespace: kube-system - labels: - k8s-app: calico - role.kubernetes.io/networking: "1" -spec: - template: - metadata: - name: configure-calico-ippool-remove - annotations: - scheduler.alpha.kubernetes.io/critical-pod: '' - spec: - hostNetwork: true - serviceAccountName: calico - tolerations: - - key: node-role.kubernetes.io/master - effect: NoSchedule - - key: CriticalAddonsOnly - operator: Exists - restartPolicy: OnFailure - containers: - - name: configure-calico - image: calico/ctl:v1.2.1 - args: - - delete - - ipPool - - {{NON_MASQUERADE_CIDR}} - env: - # The location of the etcd cluster. - - name: ETCD_ENDPOINTS - valueFrom: - configMapKeyRef: - name: calico-config - key: etcd_endpoints diff --git a/hack/.shellcheck_failures b/hack/.shellcheck_failures index 4e9ab40fcd56..0cfe61171d3d 100644 --- a/hack/.shellcheck_failures +++ b/hack/.shellcheck_failures @@ -1,6 +1,5 @@ ./addons/cluster-autoscaler/cluster-autoscaler.sh ./addons/prometheus-operator/sync-repo.sh -./docs/calico_cidr_migration/create_migration_manifest.sh ./hack/common.sh ./hack/dev-build.sh ./hack/make-apimachinery.sh