Skip to content

Commit b166791

Browse files
authored
Merge pull request kcl-lang#114 from Peefy/argocd-guide-i18n-zh-CN
docs: add argocd guide Chinese version.
2 parents 3e17576 + 9aa01c5 commit b166791

File tree

2 files changed

+72
-104
lines changed

2 files changed

+72
-104
lines changed

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/gitops/1-quick-start.md

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,34 @@ sidebar_label: 快速开始
99

1010
### 什么是 GitOps
1111

12-
GitOps is a modern way to do continuous delivery. Its core idea is to have a Git repository which contains environmental and application configurations. An automated process is also needed for sync the config to cluster.
12+
GitOps 是一种实现持续交付的现代方式。它的核心思想是拥有一个包含环境和应用程序配置的 Git 存储库。通过更改应用存储库中的文件,可以自动部署应用程序。应用 GitOps 的好处包括:
1313

14-
By changing the files in repository, developers can apply the applications automatically. The benefits of applying GitOps include:
14+
+ 提高生产力,持续交付可以加快部署时间。
15+
+ 降低开发人员部署的障碍。通过推送代码而不是容器配置,开发人员可以在不知道其内部实现的情况下轻松部署 Kubernetes 集群和应用。
16+
+ 追踪变更记录。使用 Git 管理配置使每一项更改都具有可跟踪性,从而增强审计跟踪。
1517

16-
+ Increased productivity. Continuous delivery can speed up the time of deployment.
17-
+ Lower the barrier for developer to deploy. By pushing code instead of container configuration, developers can easily deploy Kubernetes without knowing its internal implementation.
18-
+ Trace the change records. Managing the cluster with Git makes every change traceable, enhancing the audit trail.
19-
+ Recover the cluster with Git's rollback and branch.
18+
### 将 KCL 与 ArgoCD 一起使用
2019

21-
### GitOps with KCL
20+
[KCL](https://github.com/kcl-lang/kcl)[ArgoCD](https://github.com/argoproj/argo-cd) 等 GitOps 工具一起使用具有如下好处:
2221

23-
Benefits of Using KCL and ArgoCD Together:
22+
+ 通过 KCL 语言的[抽象能力](/docs/user_docs/guides/abstraction)和可编程能力可以帮助我们**简化复杂的 Kubernetes 部署配置文件**,降低手动编写 YAML 文件的错误率,消除多余的配置模版,提升多环境多租户的配置扩展能力,同时提高配置的可读性和可维护性。
23+
+ KCL 允许开发人员以声明式的方式定义应用程序所需的资源,通过将 KCL 和 ArgoCD 相结合可以帮助我们更好地实现**基础设施即代码(IaC)**,提高部署效率,简化应用程序的配置管理。
24+
+ ArgoCD 可以**自动化**地实现应用程序的连续部署,并提供友好的可视化界面全面。
2425

25-
+ KCL can help us **simplify complex Kubernetes deployment configuration files**, reduce the error rate of manually writing YAML files, and improve code readability and maintainability.
26-
+ ArgoCD can **automate** the deployment of Kubernetes applications, achieve continuous deployment, and provide comprehensive monitoring and control functions.
27-
+ By combining KCL and ArgoCD, deployment efficiency can be improved, errors reduced, and management and monitoring of Kubernetes applications strengthened.
28-
+ The combination of KCL and ArgoCD can also help us achieve **Infrastructure as Code (IaC)**, simplify application deployment and management, and better implement DevOps principles.
26+
使用 GitOps,开发人员和运维团队可以通过分别修改应用和配置代码来管理应用程序的部署,GitOps 工具链将自动同步对配置的更改,从而实现持续部署并确保一致性。如果出现问题,可以使用 GitOps 工具链快速回滚。
2927

30-
With GitOps, developer and operation teams can manage application deployment and configuration by modifying KCL code and generating YAML files. The GitOps toolchain will automatically synchronize the changes to the Kubernetes cluster, enabling continuous deployment and ensuring consistency. If there are issues, the GitOps toolchain can be used to quickly rollback.
28+
## 快速开始
3129

32-
## How to
30+
### 1. 获取示例
3331

34-
### 1. Get the Example
35-
36-
Firstly, let's get the example.
32+
首先,我们执行 git 命令获得用例
3733

3834
```bash
3935
git clone https://github.com/kcl-lang/kcl-lang.io.git/
4036
cd ./kcl-lang.io/examples/gitops
4137
```
4238

43-
We can run the following command to show the config.
39+
我们可以运行以下命令来显示配置
4440

4541
```bash
4642
cat config/main.k
@@ -62,70 +58,62 @@ config = app.App {
6258
}
6359
```
6460

65-
In the above code, we defined a configuration using the `App` schema, where we configured an `gcr.io/heptio-images/ks-guestbook-demo:0.2` container and configured it with an `80` service port.
66-
67-
### 2. Install Kubernetes and GitOps Tool
61+
在上述代码中,我们定义使用 `App` schema 定义了应用的配置,其中我们配置了一个镜像为 `gcr.io/heptio images/ks guestbook demo:0.2` 容器,并启用了 `80` 端口。
62+
63+
### 2. 安装 Kubernetes GitOps 工具
6864

69-
#### Setup Kubernetes Cluster and ArgoCD Controllers
65+
#### 配置 Kubernetes 集群和 ArgoCD 控制器
7066

71-
+ Install [K3d](https://github.com/k3d-io/k3d) to create a default cluster.
67+
+ 安装 [K3d](https://github.com/k3d-io/k3d) 并创建一个集群
7268

7369
```bash
7470
k3d cluster delete mycluster && k3d cluster create mycluster
7571
```
7672

77-
+ Install [ArgoCD](https://github.com/argoproj/argo-cd/releases/).
73+
> 注意:你可以在此方案中使用其他方式创建您自己的 Kubernetes 集群,如 kind, minikube 等。
74+
75+
+ 安装 [ArgoCD](https://github.com/argoproj/argo-cd/releases/).
7876

7977
```bash
8078
kubectl create namespace argocd
8179
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
8280
```
8381

84-
+ Enable ArgoCD KCL Plugin
85-
86-
Write the patch YAML configuration file and update the ArgoCD configuration:
82+
+ 安装 ArgoCD KCL 插件
8783

8884
```bash
89-
kubectl apply -f ./install/kcl-cmp.yaml
85+
kubectl apply -f ./install/kcl-cmp.yaml && kubectl -n argocd patch deploy/argocd-repo-server -p "$(cat ./install/patch-argocd-repo-server.yaml)"
9086
```
9187

92-
After completing the first step, ArgoCD will recognize the KCL plugin, but the KCL plugin has not been loaded into the ArgoCD image. To implement configuration drift detection, we have to tune the Deployment of argocd-repo-server.
93-
94-
```bash
95-
kubectl -n argocd patch deploy/argocd-repo-server -p "$(cat ./install/patch-argocd-repo-server.yaml)"
96-
```
97-
98-
Wait for the init container to complete execution (Running).
88+
+ 通过 `kubectl get` 命令查看 argocd 控制器容器是否初始化完成进入运行(Running)状态。
9989

10090
```bash
10191
kubectl get pod -n argocd -l app.kubernetes.io/name=argocd-repo-server
10292
```
10393

104-
+ To access the ArgoCD web UI
94+
+ 通过如下命令打开 ArgoCD UI
10595

10696
```bash
10797
kubectl port-forward svc/argocd-server -n argocd 8080:443
10898
```
10999

110-
+ Open a browser and go to: `https://localhost:8080`
111-
112-
+ The username is "admin" and password get be obtained from the following command:
100+
+ 打开浏览器 `https://localhost:8080` 输入用户名 "admin" 和密码登陆 ArgoCD UI,密码可以通过如下命令得到:
113101

114102
```bash
115103
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
116104
```
117105

118-
#### Setup ArgoCD CLI
106+
#### 安装 ArgoCD 客户端工具
119107

120-
+ Install [ArgoCD CLI](https://github.com/argoproj/argo-cd/releases)
108+
+ 安装 [ArgoCD 客户端工具](https://github.com/argoproj/argo-cd/releases)
121109

122-
Use "admin" and password to login to ArgoCD
110+
+ 使用用户名 "admin" 和刚才得到的密码登陆
123111

124112
```bash
125113
argocd login localhost:8080
126114
```
127115

128-
Create ArgoCD Application
116+
通过如下命令创建一个 ArgoCD KCL 应用
129117

130118
```bash
131119
argocd app create guestbook \
@@ -136,24 +124,20 @@ argocd app create guestbook \
136124
--config-management-plugin kcl-v1.0
137125
```
138126

139-
If you are using a private repository, you need to configure the private repository access with private key credentials before executing the create command.
140-
141-
Please refer [Private Repositories](https://argo-cd.readthedocs.io/en/stable/user-guide/private-repositories/#ssh-private-key-credential) for more details.
127+
如果创建成功,您可以看到如下输出:
142128

143129
After successfully creating, you can see the following output:
144130

145131
```bash
146132
application 'guestbook' created
147133
```
148134

149-
Through the ArgoCD UI, you can see that the created applications have not been synchronized yet. Here, you can manually synchronize or set automatic synchronization.
135+
> 如果您使用的是私有存储库,则在执行 create 命令之前,需要使用私钥凭据配置专用私有存储库访问权限。请参阅[这里](https://argo-cd.readthedocs.io/en/stable/user-guide/private-repositories/)以获取更多详细信息。
136+
137+
通过 ArgoCD UI,您可以看到创建的应用程序尚未同步,您可以手动进行配置同步或设置为自动同步。
150138

151139
![](/img/docs/user_docs/guides/gitops/argocd-kcl-app.jpg)
152140

153-
For more information on synchronization strategies, see [Sync Options](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/)
141+
有关同步策略的更多信息,可以请参阅[这里](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/)
154142

155143
![](/img/docs/user_docs/guides/gitops/argocd-kcl-app-dashboard.jpg)
156-
157-
## Summary
158-
159-
With GitOps, you can easily manage your applications and configuration in your Kubernetes cluster with KCL, ensuring that your applications are always in the desired state.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/gitops/1-quick-start.md

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,34 @@ sidebar_label: 快速开始
99

1010
### 什么是 GitOps
1111

12-
GitOps is a modern way to do continuous delivery. Its core idea is to have a Git repository which contains environmental and application configurations. An automated process is also needed for sync the config to cluster.
12+
GitOps 是一种实现持续交付的现代方式。它的核心思想是拥有一个包含环境和应用程序配置的 Git 存储库。通过更改应用存储库中的文件,可以自动部署应用程序。应用 GitOps 的好处包括:
1313

14-
By changing the files in repository, developers can apply the applications automatically. The benefits of applying GitOps include:
14+
+ 提高生产力,持续交付可以加快部署时间。
15+
+ 降低开发人员部署的障碍。通过推送代码而不是容器配置,开发人员可以在不知道其内部实现的情况下轻松部署 Kubernetes 集群和应用。
16+
+ 追踪变更记录。使用 Git 管理配置使每一项更改都具有可跟踪性,从而增强审计跟踪。
1517

16-
+ Increased productivity. Continuous delivery can speed up the time of deployment.
17-
+ Lower the barrier for developer to deploy. By pushing code instead of container configuration, developers can easily deploy Kubernetes without knowing its internal implementation.
18-
+ Trace the change records. Managing the cluster with Git makes every change traceable, enhancing the audit trail.
19-
+ Recover the cluster with Git's rollback and branch.
18+
### 将 KCL 与 ArgoCD 一起使用
2019

21-
### GitOps with KCL
20+
[KCL](https://github.com/kcl-lang/kcl)[ArgoCD](https://github.com/argoproj/argo-cd) 等 GitOps 工具一起使用具有如下好处:
2221

23-
Benefits of Using KCL and ArgoCD Together:
22+
+ 通过 KCL 语言的[抽象能力](/docs/user_docs/guides/abstraction)和可编程能力可以帮助我们**简化复杂的 Kubernetes 部署配置文件**,降低手动编写 YAML 文件的错误率,消除多余的配置模版,提升多环境多租户的配置扩展能力,同时提高配置的可读性和可维护性。
23+
+ KCL 允许开发人员以声明式的方式定义应用程序所需的资源,通过将 KCL 和 ArgoCD 相结合可以帮助我们更好地实现**基础设施即代码(IaC)**,提高部署效率,简化应用程序的配置管理。
24+
+ ArgoCD 可以**自动化**地实现应用程序的连续部署,并提供友好的可视化界面全面。
2425

25-
+ KCL can help us **simplify complex Kubernetes deployment configuration files**, reduce the error rate of manually writing YAML files, and improve code readability and maintainability.
26-
+ ArgoCD can **automate** the deployment of Kubernetes applications, achieve continuous deployment, and provide comprehensive monitoring and control functions.
27-
+ By combining KCL and ArgoCD, deployment efficiency can be improved, errors reduced, and management and monitoring of Kubernetes applications strengthened.
28-
+ The combination of KCL and ArgoCD can also help us achieve **Infrastructure as Code (IaC)**, simplify application deployment and management, and better implement DevOps principles.
26+
使用 GitOps,开发人员和运维团队可以通过分别修改应用和配置代码来管理应用程序的部署,GitOps 工具链将自动同步对配置的更改,从而实现持续部署并确保一致性。如果出现问题,可以使用 GitOps 工具链快速回滚。
2927

30-
With GitOps, developer and operation teams can manage application deployment and configuration by modifying KCL code and generating YAML files. The GitOps toolchain will automatically synchronize the changes to the Kubernetes cluster, enabling continuous deployment and ensuring consistency. If there are issues, the GitOps toolchain can be used to quickly rollback.
28+
## 快速开始
3129

32-
## How to
30+
### 1. 获取示例
3331

34-
### 1. Get the Example
35-
36-
Firstly, let's get the example.
32+
首先,我们执行 git 命令获得用例
3733

3834
```bash
3935
git clone https://github.com/kcl-lang/kcl-lang.io.git/
4036
cd ./kcl-lang.io/examples/gitops
4137
```
4238

43-
We can run the following command to show the config.
39+
我们可以运行以下命令来显示配置
4440

4541
```bash
4642
cat config/main.k
@@ -62,70 +58,62 @@ config = app.App {
6258
}
6359
```
6460

65-
In the above code, we defined a configuration using the `App` schema, where we configured an `gcr.io/heptio-images/ks-guestbook-demo:0.2` container and configured it with an `80` service port.
66-
67-
### 2. Install Kubernetes and GitOps Tool
61+
在上述代码中,我们定义使用 `App` schema 定义了应用的配置,其中我们配置了一个镜像为 `gcr.io/heptio images/ks guestbook demo:0.2` 容器,并启用了 `80` 端口。
62+
63+
### 2. 安装 Kubernetes GitOps 工具
6864

69-
#### Setup Kubernetes Cluster and ArgoCD Controllers
65+
#### 配置 Kubernetes 集群和 ArgoCD 控制器
7066

71-
+ Install [K3d](https://github.com/k3d-io/k3d) to create a default cluster.
67+
+ 安装 [K3d](https://github.com/k3d-io/k3d) 并创建一个集群
7268

7369
```bash
7470
k3d cluster delete mycluster && k3d cluster create mycluster
7571
```
7672

77-
+ Install [ArgoCD](https://github.com/argoproj/argo-cd/releases/).
73+
> 注意:你可以在此方案中使用其他方式创建您自己的 Kubernetes 集群,如 kind, minikube 等。
74+
75+
+ 安装 [ArgoCD](https://github.com/argoproj/argo-cd/releases/).
7876

7977
```bash
8078
kubectl create namespace argocd
8179
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
8280
```
8381

84-
+ Enable ArgoCD KCL Plugin
85-
86-
Write the patch YAML configuration file and update the ArgoCD configuration:
82+
+ 安装 ArgoCD KCL 插件
8783

8884
```bash
89-
kubectl apply -f ./install/kcl-cmp.yaml
85+
kubectl apply -f ./install/kcl-cmp.yaml && kubectl -n argocd patch deploy/argocd-repo-server -p "$(cat ./install/patch-argocd-repo-server.yaml)"
9086
```
9187

92-
After completing the first step, ArgoCD will recognize the KCL plugin, but the KCL plugin has not been loaded into the ArgoCD image. To implement configuration drift detection, we have to tune the Deployment of argocd-repo-server.
93-
94-
```bash
95-
kubectl -n argocd patch deploy/argocd-repo-server -p "$(cat ./install/patch-argocd-repo-server.yaml)"
96-
```
97-
98-
Wait for the init container to complete execution (Running).
88+
+ 通过 `kubectl get` 命令查看 argocd 控制器容器是否初始化完成进入运行(Running)状态。
9989

10090
```bash
10191
kubectl get pod -n argocd -l app.kubernetes.io/name=argocd-repo-server
10292
```
10393

104-
+ To access the ArgoCD web UI
94+
+ 通过如下命令打开 ArgoCD UI
10595

10696
```bash
10797
kubectl port-forward svc/argocd-server -n argocd 8080:443
10898
```
10999

110-
+ Open a browser and go to: `https://localhost:8080`
111-
112-
+ The username is "admin" and password get be obtained from the following command:
100+
+ 打开浏览器 `https://localhost:8080` 输入用户名 "admin" 和密码登陆 ArgoCD UI,密码可以通过如下命令得到:
113101

114102
```bash
115103
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
116104
```
117105

118-
#### Setup ArgoCD CLI
106+
#### 安装 ArgoCD 客户端工具
119107

120-
+ Install [ArgoCD CLI](https://github.com/argoproj/argo-cd/releases)
108+
+ 安装 [ArgoCD 客户端工具](https://github.com/argoproj/argo-cd/releases)
121109

122-
Use "admin" and password to login to ArgoCD
110+
+ 使用用户名 "admin" 和刚才得到的密码登陆
123111

124112
```bash
125113
argocd login localhost:8080
126114
```
127115

128-
Create ArgoCD Application
116+
通过如下命令创建一个 ArgoCD KCL 应用
129117

130118
```bash
131119
argocd app create guestbook \
@@ -136,24 +124,20 @@ argocd app create guestbook \
136124
--config-management-plugin kcl-v1.0
137125
```
138126

139-
If you are using a private repository, you need to configure the private repository access with private key credentials before executing the create command.
140-
141-
Please refer [Private Repositories](https://argo-cd.readthedocs.io/en/stable/user-guide/private-repositories/#ssh-private-key-credential) for more details.
127+
如果创建成功,您可以看到如下输出:
142128

143129
After successfully creating, you can see the following output:
144130

145131
```bash
146132
application 'guestbook' created
147133
```
148134

149-
Through the ArgoCD UI, you can see that the created applications have not been synchronized yet. Here, you can manually synchronize or set automatic synchronization.
135+
> 如果您使用的是私有存储库,则在执行 create 命令之前,需要使用私钥凭据配置专用私有存储库访问权限。请参阅[这里](https://argo-cd.readthedocs.io/en/stable/user-guide/private-repositories/)以获取更多详细信息。
136+
137+
通过 ArgoCD UI,您可以看到创建的应用程序尚未同步,您可以手动进行配置同步或设置为自动同步。
150138

151139
![](/img/docs/user_docs/guides/gitops/argocd-kcl-app.jpg)
152140

153-
For more information on synchronization strategies, see [Sync Options](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/)
141+
有关同步策略的更多信息,可以请参阅[这里](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-options/)
154142

155143
![](/img/docs/user_docs/guides/gitops/argocd-kcl-app-dashboard.jpg)
156-
157-
## Summary
158-
159-
With GitOps, you can easily manage your applications and configuration in your Kubernetes cluster with KCL, ensuring that your applications are always in the desired state.

0 commit comments

Comments
 (0)