需要一个关于kube-proxy配置文件的例子

时间:2017-08-01 12:46:46

标签: kubernetes

安装kubernetes 1.7.2时会出现关于kube-proxy的警告

WARNING: all flags other than --config, --write-config-to, and --cleanup-iptables are deprecated. Please begin using a config file ASAP.

所以我尝试制作我自己的配置文件,就像这样,

{
  "bind-address": "10.110.200.42",
  "hostname-override": "10.110.200.42",
  "cluster-cidr": "172.30.0.0/16",
  "logtostderr": true,
  "v": 0,
  "allow-privileged": true,
  "master": "http://10.110.200.42:8080",
  "etcd-servers": "http://10.110.200.42:2379"
}

但我仍然收到错误

error: Object 'apiVersion' is missing in '{

我想我需要一些关于配置文件的例子,但我google搜索没有任何结果,甚至在git中搜索源代码,我发现没什么用,请帮忙!

ps,我找到了生成示例文件的方法,只需使用--write-config-to命令行,示例如下

apiVersion: componentconfig/v1alpha1
bindAddress: 0.0.0.0
clientConnection:
  acceptContentTypes: ""
  burst: 10
  contentType: application/vnd.kubernetes.protobuf
  kubeconfig: ""
  qps: 5
clusterCIDR: ""
configSyncPeriod: 15m0s
conntrack:
  max: 0
  maxPerCore: 32768
  min: 131072
  tcpCloseWaitTimeout: 1h0m0s
  tcpEstablishedTimeout: 24h0m0s
enableProfiling: false
featureGates: ""
healthzBindAddress: 0.0.0.0:10256
hostnameOverride: ""
iptables:
  masqueradeAll: false
  masqueradeBit: 14
  minSyncPeriod: 0s
  syncPeriod: 30s
kind: KubeProxyConfiguration
metricsBindAddress: 127.0.0.1:10249
mode: ""
oomScoreAdj: -999
portRange: ""
resourceContainer: /kube-proxy
udpTimeoutMilliseconds: 250ms

1 个答案:

答案 0 :(得分:0)

我使用的是k8s版本1.10.3,为了简单和测试,我通过添加项目来禁用apiserver中的服务帐户

--disable-admission-plugins=ServiceAccount

对于kube-proxy,只需添加--master项,例如

./kube-proxy --master 127.0.0.1:8080 --v=3

并且kube-proxy结果正常工作。