Kubernetes查询利器:Cyphernetes入门教程

Kubernetes查询利器:Cyphernetes入门教程

cyphernetes Kubernetes CLI and library for complex operations using a Cypher-inspired query language cyphernetes 项目地址: https://gitcode.com/gh_mirrors/cy/cyphernetes

1. 项目介绍

Cyphernetes 是一种受 Cypher 启发的 Kubernetes 查询语言,它结合了 ASCII 艺术风格、SQL 和 JSONPath 的特点,允许用户以有趣和创造性的方式表达 Kubernetes 图形操作。Cyphernetes 支持开箱即用的 CRD、多集群查询等功能。

2. 项目快速启动

安装 Cyphernetes

使用 Homebrew 安装:

brew install cyphernetes

或者使用 go 命令:

go install github.com/avitaltamir/cyphernetes/cmd/cyphernetes@latest

也可以从 Release 页面下载预编译的二进制文件。

启动 Web 客户端

在终端中运行以下命令启动 Web 客户端:

cyphernetes web

然后在浏览器中访问 http://localhost:8080

使用交互式 Shell

在终端中运行以下命令进入交互式 Shell:

cyphernetes shell

3. 应用案例和最佳实践

删除所有非运行状态的 Pod

使用 Cyphernetes 查询替代传统的 kubectl 命令:

# 传统 kubectl 命令
kubectl get pods --all-namespaces --field-selector 'status.phase!=Running' -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name --no-headers | xargs -L1 -I {} bash -c 'set -- {}; kubectl delete pod $2 -n $1'

# Cyphernetes 查询
MATCH (p:Pod) WHERE p.status.phase != "Running" DELETE p;

获取所有部署的期望和运行副本数

MATCH (d:Deployment) RETURN d.spec.replicas AS desiredReplicas, d.status.availableReplicas AS runningReplicas;

4. 典型生态项目

Cyphernetes 的生态项目包括:

  • cyphernetes:核心 Go 包
  • cyphernetes-cli:命令行界面
  • cyphernetes-web:Web 客户端
  • cyphernetes-operator:Kubernetes 操作符

通过以上教程,您可以快速上手 Cyphernetes 并开始使用它进行 Kubernetes 的查询和管理。

cyphernetes Kubernetes CLI and library for complex operations using a Cypher-inspired query language cyphernetes 项目地址: https://gitcode.com/gh_mirrors/cy/cyphernetes

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卓融浪Keene

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值