AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-91332

RogerFC's questions

Martin Hope
RogerFC
Asked: 2022-12-02 09:34:52 +0800 CST

如何在 Kustomization 文件中编辑补丁项以使用 Helm 执行 gitop(并避免补丁堆积)

  • 5

我正在寻找一种更好的方法来使用 GitOps 更新在 HelmRelease 中定义的 docker 图像,因为我当前的方法会产生噪音。

在将 Helm 引入我使用 GitOps 管理的集群后,我发现了一些关于如何正确声明要在集群中使用的新 docker 映像构建的困难。

在部署中,我可以使用简单的 Kustomization 资源来替换图像元素,例如:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: my-namespace

resources:
- namespace.yaml
- my-deployment.yaml

images:
- name: my/image
  newName: my/image
  newTag: updated-tag

对于每个新版本,我只需修改文件

kustomize edit set image my/image=my/image:updated-tag

现在使用 Helm 我不能使用相同的技巧,因为我需要更新spec.values.imageHelmRelease 中的标签,而 Kustomize 似乎没有它的简写形式。所以选择是创建一个补丁:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: my-namespace

resources:
- namespace.yaml
- my-helm-release.yaml

patches:
- patch: '[{"op": "replace", "path": "/spec/values/image", "value": "my/image:updated-tag"}]'
  target:
    kind: HelmRelease
    name: my-helm-release
    namespace: my-namespace

通过使用类似的命令:

kustomize edit add patch \
    --kind HelmRelease \
    --name my-helm-release \
    --namespace my-namespace --patch "[{\"op\": \"replace\", \"path\": \"/spec/values/image\", \"value\": \"my/image:updated-tag\"}]"

(不要介意引用的报价,请耐心等待)

多次运行此命令时会出现问题。虽然kustomize edit set image覆盖了以前的值,但在后一种情况下,一个新patch的附加到列表中,带有more-updated-tag.

patches:
- patch: '[{"op": "replace", "path": "/spec/values/image", "value": "my/image:updated-tag"}]'
  target:
    kind: HelmRelease
    name: my-helm-release
    namespace: my-namespace
- patch: '[{"op": "replace", "path": "/spec/values/image", "value": "my/image:more-updated-tag"}]'
  target:
    kind: HelmRelease
    name: my-helm-release
    namespace: my-namespace

我怎样才能避免这种重复并为我的文件添加越来越多的噪音?

谢谢!

helm
  • 1 个回答
  • 40 Views
Martin Hope
RogerFC
Asked: 2018-03-31 08:33:11 +0800 CST

Chef 升级后删除了 chef-solo 二进制文件,重新安装后返回

  • 0

我正在为 ubuntu trusty 设置服务器配置,该配置必须与使用 chef-solo 的节点配置兼容。

这是在 AWS EC2 中,基本节点来自https://cloud-images.ubuntu.com/locator/ec2/中的官方 ubuntu 存储库

此基础映像已包含 chef v11.6.2-1.ubuntu.13.04,并且可以使用 chef-solo 二进制文件。好的。

但是在将 chef 包升级到 v11.8.2-2 时,chef-solo 二进制文件以及其他一些 chef 二进制文件就消失了。如果我删除并再次安装相同的软件包(或重新安装),它们会再次出现。

$ dpkg -s chef | grep ^Version
Version: 11.6.2-1.ubuntu.13.04
$ ls -1 /usr/bin | grep chef
chef-apply
chef-client
chef-shell
chef-solo

$ sudo aptitude upgrade chef -y
$ dpkg -s chef | grep ^Version
Version: 11.8.2-2
$ ls /usr/bin | grep chef
chef-service-manager
chef-zero

$ sudo aptitude reinstall chef -y
$ dpkg -s chef | grep ^Version
Version: 11.8.2-2
$ ls /usr/bin | grep chef
chef-apply
chef-client
chef-service-manager
chef-shell
chef-solo
chef-zero

并且删除然后重新安装的依赖项完全相同。

$ sudo aptitude remove chef
The following packages will be REMOVED:  
  chef chef-zero{u} erubis{u} ohai{u} ruby-diff-lcs{u} ruby-erubis{u} ruby-hashie{u} ruby-highline{u} ruby-ipaddress{u} ruby-json{u} ruby-mime-types{u} ruby-mixlib-authentication{u} ruby-mixlib-cli{u} ruby-mixlib-config{u} 
  ruby-mixlib-log{u} ruby-mixlib-shellout{u} ruby-net-ssh{u} ruby-net-ssh-gateway{u} ruby-net-ssh-multi{u} ruby-rack{u} ruby-rest-client{u} ruby-sigar{u} ruby-systemu{u} ruby-yajl{u} 
0 packages upgraded, 0 newly installed, 24 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 8,363 kB will be freed.

$ sudo aptitude install chef
The following NEW packages will be installed:
  chef chef-zero{a} erubis{a} ohai{a} ruby-diff-lcs{a} ruby-erubis{a} ruby-hashie{a} ruby-highline{a} ruby-ipaddress{a} ruby-json{a} ruby-mime-types{a} ruby-mixlib-authentication{a} ruby-mixlib-cli{a} ruby-mixlib-config{a} 
  ruby-mixlib-log{a} ruby-mixlib-shellout{a} ruby-net-ssh{a} ruby-net-ssh-gateway{a} ruby-net-ssh-multi{a} ruby-rack{a} ruby-rest-client{a} ruby-sigar{a} ruby-systemu{a} ruby-yajl{a} 
0 packages upgraded, 24 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,278 kB of archives. After unpacking 8,363 kB will be used.

安装的二进制文件的唯一区别是,在 v11.6 上,它们是从 /usr/bin 到 /opt/chef/bin 的链接,但在 v11.8 中,二进制文件位于/usr/bin 中。

这很不方便,好像我在第一次运行 chef 时进行了升级,如果没有手动干预,我将无法再运行 chef。

谁能帮我理解发生了什么,我怎样才能在厨师中升级这个包而不遇到这个问题?

PS:我知道我可以保留这个版本的 v11.6,但这不是我要问的。

ubuntu
  • 1 个回答
  • 39 Views
Martin Hope
RogerFC
Asked: 2017-12-15 02:33:30 +0800 CST

AWS OpenVPN 多 VPC + ClassicLink 上的路由

  • 0

我在 AWS 中设置的多区域网络中的服务器之间连接时遇到问题,因为并非所有服务器都可以从网络中的任何点访问。

我通过 openvpn 隧道将 eu-central-1 中的 VPC (A) 连接到 eu-southeast-1 中的另一个 (B),第二个 VPC 通过 ClassicLink 连接到 EC2-Classic (EC2) 节点。此连接是通过几个对等服务器建立的,VPC A 中的对等服务器 A 和 VPC B 中的对等服务器 b。用户通过 openvpn 连接到 VPC A,并通过 openvpn 服务器 vpnserver-a。

网络图是这样的:

+---------+   +---------+   +---------+   +----+
|user     |   |VPC A    |   |VPC B    |   |EC2 |
|172.20/16+---+172.29/16+---+172.31/16+---+10/8|
+---------+   +---------+   +---------+   +----+
           VPN           VPN       ClassicLink

问题是我无法建立任何这样的联系:

  • 用户到 EC2 中的任何节点
  • VPC A 中的任何节点到 EC2 中的任何节点
  • EC2 中的任何节点到 VPC A 中的任何节点

从用户到 VPC A 和 B 以及 VPC A 和 B 之间的连接工作正常。

我怀疑路由有问题,但我一直无法解决。

路由设置如下:

  • vpnserver-a 向用户发布路由 172.29/16、172.31/16 和 10/8(openvpn 配置文件)
  • peering-a 将路由 172.31/16 和 10/8 发布到 VPC A(openvpn 配置文件)
  • peering-b 将路由 172.29/16 和 172.20/16 发布到 VPC B(openvpn 配置文件)
  • VPC A 中的路由表将 172.31/16 和 10/8 路由到对等互连-a(AWS VPC 子网路由表)
  • VPC B 中的路由表将 172.29/16 和 172.20/16 路由到 peering-b(AWS VPC 子网路由表)

网络 ACL 对这些子网之间的所有流量开放。安全组也设置为接受连接。

我使用 tcpdump 进行了一些(基本)数据包检查,以尝试了解路由是否适用于以下结果: - 尝试从 VPC A 中的 node-a 连接到 EC2 中的 node-ec2,我可以看到数据包通过 peering-a和 peering-b,但没有到达 node-ec2 - 尝试从 node-ec2 连接到 node-a,我什至看不到到达 peering-b 的数据包

所以我怀疑 ClassicLink 中的路由涉及我不知道的其他配置。

如何设置丢失的路线?这甚至可能吗?

谢谢!

amazon-web-services
  • 1 个回答
  • 530 Views
Martin Hope
RogerFC
Asked: 2017-03-14 02:19:25 +0800 CST

通过中间主机的 SSH 仅在 myuser@mymac 上失败,但在其他地方有效

  • 11

我无法在我的 macbook 上使用我的用户通过 ssh 连接到我的数据中心节点之一。这是一个最近出现的问题,从几周前开始就非常实用。

奇怪的是,这只会影响我计算机上的用户,但我能够从以下位置建立连接:

  • 同一台机器上的不同用户,使用相同的 ssh 密钥并且没有任何 .ssh/config 规则。
  • 不同的服务器,运行 macos 或 ubuntu,具有相同或不同的 ssh 密钥。

在我的计算机中使用我的用户名和相同的密钥,我可以:

  • 连接到网关主机
  • 使用 VPN 直接连接到节点(不幸的是,这不是一个长期的解决方案)

我对这个错误感到很困惑。你能帮我定位问题吗?

查看日志,与网关的连接已建立,但无法连接到节点。在客户端:

⌘ ~ ❯ ssh -v -J gatekeeper@gateway ubuntu@node -i ~/.ssh/id_rsa 
OpenSSH_7.3p1, LibreSSL 2.4.1
[...]
debug1: Authentication succeeded (publickey).
Authenticated to gateway ([35.156.248.245]:22).
debug1: channel_connect_stdio_fwd node:22
debug1: channel 0: new [stdio-forward]
debug1: getpeername failed: Bad file descriptor
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
debug1: client_input_global_request: rtype [email protected] want_reply 1
channel 0: open failed: connect failed: Connection timed out
stdio forwarding failed
ssh_exchange_identification: Connection closed by remote host

在网关端:

admin@gateway:~$ grep -e "\[7669\]" -e "\[7739\]" /var/log/auth.log
Mar 13 11:01:20 gateway sshd[7669]: Set /proc/self/oom_score_adj to 0
Mar 13 11:01:20 gateway sshd[7669]: rexec line 32: Deprecated option PermitBlacklistedKeys
Mar 13 11:01:20 gateway sshd[7669]: Connection from <laptop-out-ip> port 62113 on <gateway-ip> port 22
Mar 13 11:01:20 gateway sshd[7669]: Postponed publickey for gatekeeper from <laptop-out-ip> port 62113 ssh2 [preauth]
Mar 13 11:01:20 gateway sshd[7669]: Accepted publickey for gatekeeper from <laptop-out-ip> port 62113 ssh2: RSA 8d:7e:9c:53:11:c9:4d:b3:67:7b:ae:04:03:8f:e2:71
Mar 13 11:01:20 gateway sshd[7669]: pam_unix(sshd:session): session opened for user gatekeeper by (uid=0)
Mar 13 11:01:20 gateway sshd[7669]: User child is on pid 7739
Mar 13 11:03:27 gateway sshd[7739]: error: connect_to <node-ip> port 22: failed.
Mar 13 11:03:28 gateway sshd[7739]: Connection closed by <laptop-out-ip>
Mar 13 11:03:28 gateway sshd[7739]: Transferred: sent 2252, received 2864 bytes
Mar 13 11:03:28 gateway sshd[7739]: Closing connection to <laptop-out-ip> port 62113
Mar 13 11:03:28 gateway sshd[7669]: pam_unix(sshd:session): session closed for user gatekeeper

在节点端,日志中没有条目。

网关上的 ssd_config:

# ssh service configuration

AcceptEnv
AddressFamily inet
AllowAgentForwarding yes
AllowGroups
AllowTcpForwarding no
AllowUsers gatekeeper
AuthorizedKeysFile %h/.ssh/authorized_keys
ChallengeResponseAuthentication no
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
ClientAliveCountMax 3
ClientAliveInterval 15
Compression delayed
DenyGroups
DenyUsers
GSSAPIAuthentication no
GatewayPorts no
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostbasedAuthentication no
KerberosAuthentication no
ListenAddress 0.0.0.0:22
LogLevel VERBOSE
LoginGraceTime 60
MaxAuthTries 6
MaxSessions 10
MaxStartups 30
PasswordAuthentication no
PermitBlacklistedKeys no
PermitRootLogin no
PermitTunnel no
PermitUserEnvironment no
PidFile /var/run/sshd.pid
PrintLastLog yes
PrintMotd no
Protocol 2
PubkeyAuthentication yes
RSAAuthentication no
RhostsRSAAuthentication no
StrictModes yes
SyslogFacility AUTH
TCPKeepAlive yes
UseDNS no
UseLogin no
UsePAM yes
UsePrivilegeSeparation yes
X11Forwarding no

Match User gatekeeper
AllowTcpForwarding yes
AllowAgentForwarding no
X11Forwarding no
ubuntu mac-osx ssh bastion
  • 5 个回答
  • 12663 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve