微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

升级API网关Kong

参考github上的dockerfile https://github.com/Kong/docker-kong/tree/master/centos ,在dockefile里面添加自定义内容进行进行编译。本例中在官方的例子上安装了telnet、iproutes等软件包,同时为了实现网关的后续的应用程序认证鉴权,增加了graphql的lua扩展模块

准备dockerfile

FROM centos:7
LABEL maintainer="Kong <[email protected]>"

ARG ASSET=ce
ENV ASSET $ASSET

ARG EE_PORTS

copY kong.rpm /tmp/kong.rpm

ARG KONG_VERSION=2.3.2
ENV KONG_VERSION $KONG_VERSION

ARG KONG_SHA256="aad05b5b7425a0c1dc3095363c785a4147d3cd91064f0221a2a818c7bdcc97dc"

RUN set -ex; \
  if [ "$ASSET" = "ce" ] ; then \
    curl -fL "https://bintray.com/kong/kong-rpm/download_file?file_path=centos/7/kong-$KONG_VERSION.el7.amd64.rpm" -o /tmp/kong.rpm \
    && echo "$KONG_SHA256 /tmp/kong.rpm" | sha256sum -c -; \
  fi; \
  yum install -y -q unzip shadow-utils git net-tools iproute langpacks-zh_CN telnet lrzsz \
  && yum clean all -q \
  && rm -fr /var/cache/yum/* /tmp/yum_save*.yumtx /root/.pki \
  # Please update the centos install docs if the below line is changed so that
  # end users can properly install Kong along with its required dependencies
  # and that our CI does not diverge from our docs.
  && yum install -y /tmp/kong.rpm \
  && yum clean all \
  && rm /tmp/kong.rpm \
  && chown kong:0 /usr/local/bin/kong \
  && chown -R kong:0 /usr/local/kong \
  && luarocks install graphql && \  
  if [ "$ASSET" = "ce" ] ; then \
    kong version ; \
  fi;

copY docker-entrypoint.sh /docker-entrypoint.sh

USER kong

ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 8000 8443 8001 8444 $EE_PORTS

STOPSIGNAL SIGQUIT

CMD ["kong", "docker-start"]

编译推送docker镜像

docker build -t harbor.59iedu.com/fjhb/kong:2.3.2 .
docker push harbor.59iedu.com/fjhb/kong:2.3.2

更新运行中的docker

  • 修改k8s的deployment文件,替换镜像版本后进行apply
  • 涉及到版本升级,需要进入init-container wait-for-migrations,分别执行下列命令,否则proxy和ingress-controller无法成功启动
    kong migrations up
    kong migrations finish

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐