Rancher运行时错误:在不在Kubernetes之外运行时,Rancher必须使用--privileged标志运行

445 篇文章 ¥29.90 ¥99.00
本文介绍了在非Kubernetes环境中运行Rancher时遇到的‘Rancher must be ran with the --privileged flag’错误,解释了原因并提供了解决方案。通过在启动Rancher容器时添加--privileged标志,可以避免该错误,但要注意由此带来的安全风险。

Rancher运行时错误:在不在Kubernetes之外运行时,Rancher必须使用–privileged标志运行

Rancher是一个开源的容器管理平台,用于简化容器化应用程序的部署、管理和扩展。然而,在某些情况下,当我们将Rancher运行在Kubernetes之外时,可能会遇到一个错误,提示我们需要在运行Rancher时使用–privileged标志。本文将详细解释这个错误以及如何解决它。

错误消息

当我们尝试在Kubernetes之外运行Rancher时,可能会遇到以下错误消息:

Rancher must be ran with the --privileged flag when running outside of Kubernetes

这个错误消息告诉我们,当我们在Kubernetes之外运行Rancher时,需要使用--privileged标志来运行它。

问题解释

在Kubernetes之外运行Rancher时,它需要一些额外的权限来执行一些特定的操作。这些权限包括访问主机的特权操作、操作系统级别的资源和配置等。由于Rancher设计用于与Kubernetes集成,它默认会尝试使用一些需要特权权限的功能,但在非Kubernetes环境中,这些权限可能无法正常工作,因此需要手动启用特权模式。

解决方案

要解决这个错误,我们需要在启动Rancher时添加--privileged标志。这个标志指示Docker以特权模式运行容

[root@master-node ~]# cat kube-flannel-ds.yaml apiVersion: apps/v1 kind: DaemonSet metadata: name: kube-flannel-ds namespace: kube-system labels: app: flannel tier: node spec: revisionHistoryLimit: 10 selector: matchLabels: app: flannel template: metadata: labels: app: flannel tier: node spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/os operator: In values: - linux containers: - name: kube-flannel image: quay.io/coreos/flannel:v0.15.1 imagePullPolicy: IfNotPresent command: - /opt/bin/flanneld args: - --ip-masq - --kube-subnet-mgr env: - name: POD_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name - name: POD_NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace resources: limits: cpu: 100m memory: 50Mi requests: cpu: 100m memory: 50Mi securityContext: capabilities: add: - NET_ADMIN - NET_RAW privileged: false volumeMounts: - mountPath: /run/flannel name: run - mountPath: /etc/kube-flannel/ name: flannel-cfg terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst hostNetwork: true initContainers: - name: install-cni-plugin image: rancher/mirrored-flannelcni-flannel-cni-plugin:v1.0.0 command: - cp args: - -f - /flannel - /opt/cni/bin/flannel volumeMounts: - mountPath: /opt/cni/bin name: cni-plugin imagePullPolicy: IfNotPresent - name: install-cni image: quay.io/coreos/flannel:v0.15.1 command: - cp args: - -f - /etc/kube-flannel/cni-conf.json - /etc/cni/net.d/10-flannel.conflist volumeMounts: - mountPath: /etc/cni/net.d name: cni - mountPath: /etc/kube-flannel/ name: flannel-cfg imagePullPolicy: IfNotPresent priorityClassName: system-node-critical restartPolicy: Always schedulerName: default-scheduler serviceAccountName: flannel tolerations: - operator: Exists effect: NoSchedule volumes: - name: run hostPath: path: /run/flannel type: DirectoryOrCreate - name: cni-plugin hostPath: path: /opt/cni/bin type: DirectoryOrCreate - name: cni hostPath: path: /etc/cni/net.d type: DirectoryOrCreate - name: flannel-cfg configMap: name: kube-flannel-cfg defaultMode: 420 updateStrategy: rollingUpdate: maxUnavailable: 1 type: RollingUpdate [root@master-node ~]#
08-03
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值