Open wmenjoy opened 4 years ago
可以通过project + namespace 来简单实现
Rancher 如何在线升级apiserver的配置?
nodes:
- address: 192.168.xxx.xxx
user: root
role:
- controlplane
- etcd
- worker
services:
etcd:
extra_binds:
- '/etc/localtime:/etc/localtime'
kube-api:
service_node_port_range: 30000-40000
extra_binds:
- '/etc/localtime:/etc/localtime'
extra_args:
# 开启podpresets
runtime-config: "settings.k8s.io/v1alpha1=true"
enable-admission-plugins: "NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,NodeRestriction,PersistentVolumeLabel,PodPreset"
default-not-ready-toleration-seconds: 30
default-unreachable-toleration-seconds: 30
kube-controller:
extra_binds:
- '/etc/localtime:/etc/localtime'
extra_args:
# 设置evictioN策略
pod-eviction-timeout: 30s
node-monitor-grace-period: 16s
node-monitor-period: 2s
kubelet:
extra_binds:
- '/etc/localtime:/etc/localtime'
extra_args:
# 设置状态更新频率
node-status-update-frequency: 4s
eviction-pressure-transition-period: 20s
# 每台机器最大部署100个pods
max-pods: 100
# kube保留内存
kube-reserved: cpu=500m, memory=1000Mi
# 系统保留内存
system-reserved: cpu=500m, memory=1000Mi
# 系统驱逐时间
eviction-hard: memory.available<500Mi,nodefs.available<10%
# 最小驱逐
#eviction-minimum-reclaim: memory.available=0Mi,nodefs.available=500Mi,imagefs.available=2Gi
kubeproxy:
extra_binds:
- '/etc/localtime:/etc/localtime'
# 对应k8s版本号 https://github.com/rancher/kontainer-driver-metadata/blob/master/rke/k8s_rke_system_images.go#
kubernetes_version: v1.16.9-rancher1-1
cluster_name: local
这里采用的ingress.tls.source=rancher
, 其他方式待测试
# Install the CustomResourceDefinition resources separately
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.4/cert-manager.crds.yaml
# **Important:**
# If you are running Kubernetes v1.15 or below, you
# will need to add the `--validate=false` flag to your
# kubectl apply command, or else you will receive a
# validation error relating to the
# x-kubernetes-preserve-unknown-fields field in
# cert-manager’s CustomResourceDefinition resources.
# This is a benign error and occurs due to the way kubectl
# performs resource validation.
# Create the namespace for cert-manager
kubectl create namespace cert-manager
# Add the Jetstack Helm repository
helm repo add jetstack https://charts.jetstack.io
# Update your local Helm chart repository cache
helm repo update
# Install the cert-manager Helm chart
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--version v1.0.4
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
kubectl create namespace cattle-system
helm install rancher rancher-stable/rancher \
--namespace cattle-system \
--set hostname=localhost
helm pull rancher-stable/rancher
docker 离线导出rancher的相关镜像
kubectl create namespace cattle-system
helm install rancher rancher-$version.tgz \
--namespace cattle-system \
--set hostname=localhost
cert-manager is a Kubernetes add-on to automate the management and issuance of TLS certificates from various issuing sources.
It will ensure certificates are valid and up to date periodically, and attempt to renew certificates at an appropriate time before expiry.
It is loosely based upon the work of kube-lego and has borrowed some wisdom from other similar projects e.g. kube-cert-manager.
quay.io/jetstack/cert-manager-webhook:v1.1.0
quay.io/jetstack/cert-manager-cainjector: v1.1.0
quay.io/jetstack/cert-manager-controller:v1.1.0
quay.io/jetstack/cert-manager-controller: v1.0.4
quay.io/jetstack/cert-manager-cainjector:v1.0.4
quay.io/jetstack/cert-manager-webhook:v1.0.4
quay.io/jetstack/cert-manager-webhook-arm64:v1.1.0
quay.io/jetstack/cert-manager-cainjector-arm64: v1.1.0
quay.io/jetstack/cert-manager-controller-arm64:v1.1.0
quay.io/jetstack/cert-manager-controller-arm64: v1.0.4
quay.io/jetstack/cert-manager-cainjector-arm64:v1.0.4
quay.io/jetstack/cert-manager-webhook-arm64:v1.0.4
解决方案
进入 rancher server 容器,执行相关操作 docker exec -it rancher /bin/sh kubectl --insecure-skip-tls-verify -n kube-system delete secrets k3s-serving kubectl --insecure-skip-tls-verify delete secret serving-cert -n cattle-system rm -f /var/lib/rancher/k3s/server/tls/dynamic-cert.json
请求刷新参数 curl --insecure -sfL https://localhost:8443/v3
重启rancher server 容器 docker restart rancher
Rancher 概念
参考