sre8 sre10_我们的SRE最近的故障排除案例,第2部分

sre8 sre10

It’s been a while since the previous article in which we shared several captivating stories about our real-life experience in operating Kubernetes clusters as well as applications/services running in them. Here is another episode in adventures of Flant engineers sailing in turbulent waters of a large-scale (and not so large) web applications.

自从上一篇文章以来已经有一段时间了,在这篇文章中,我们分享了一些有趣的故事,这些故事讲述了我们在操作Kubernetes集群以及在其中运行的应用程序/服务的真实经验。 这是Flant工程师在大型(而不是那么大)Web应用程序的湍流中航行的冒险中的另一集。

情况1。 Kubernetes中的Kafka和Docker变量 (Case #1. Kafka and Docker variables in Kubernetes)

The container-based systems gradually become an industry standard, and many tools have already taken root in this environment. However, you can still find some ridiculous bugs related to integrating software into Docker/Kubernetes.

基于容器的系统逐渐成为行业标准,许多工具已经在此环境中扎根。 但是,您仍然会发现一些与将软件集成到Docker / Kubernetes有关的荒谬错误。

One day, we were going to deploy the standard bundle of ZooKeeper + Kafka for Sentry, with a possible addition of other components in some future. At first sight, the process looks easy: take one hard-to-read Kafka’s Helm chart as a basis (you can find it in this well-known GitHub repo), chip off all the unnecessary stuff, add some tweaks for your needs, et voila!

有一天,我们将为哨兵部署标准的ZooKeeper + Kafka软件包,并可能在将来增加其他组件。 乍一看,这个过程看起来很简单:以一个难以理解的Kafka的Helm图表为基础(您可以在这个著名的GitHub repo中找到它),剔除所有不必要的内容,根据需要添加一些调整,等等!

However, we got the following error while trying to run it:

但是,在尝试运行它时出现以下错误:

===> Configuring ...
port is deprecated. Please use KAFKA_ADVERTISED_LISTENERS instead.

That’s strange. Okay, let’s add this:

那很奇怪。 好的,我们添加以下内容:

env:
- name: KAFKA_ADVERTISED_LISTENERS
value: { { printf "%s:%s" .Chart.Name .Values.port._default }}

Still the same problem… Perhaps, it makes sense to find out what script produces the above message and why? The next question then is: “What image do we use, and what’s inside?”

仍然是同样的问题……也许,找出什么脚本产生上述消息以及为什么是有意义的? 接下来的问题是:“我们使用什么图像,内部是什么?”

This chart is based on a quite popular confluentinc/cp-kafka image that boasts a multipurpose entrypoint (as is the case with many other Confluent Community images). If you analyze what scripts are run and in what order, you will find the one that hides the source of our problems:

该图表基于一个颇受欢迎的confluentinc / cp-kafka图像,该图像具有一个多功能入口点(许多其他Confluent社区图像就是这种情况)。 如果你分析一下脚本运行,以什么顺序,你会发现一个隐藏我们问题的根源:

if [[ -n "${KAFKA_PORT-}" ]]
then
echo "port is deprecated. Please use KAFKA_ADVERTISED_LISTENERS instead."
exit 1
fi

It’s a no-brainer, right? But wait, we did not declare that variable (or anything like it)!

这很容易,对吗? 但是,等等,我们没有声明该变量(或类似的变量)!

However, if you look at the actual environment variables declared inside the container, you will find such a variable… as well as some similar others:

但是,如果查看容器内声明的实际环境变量, 则会发现这样的变量……以及一些类似的其他变量:

root@kafka-0:/# env |grep KAFKA_PORT
KAFKA_PORT_9092_TCP_PORT=9092
KAFKA_PORT_9
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值