目标 - 使用 Elasticsearch 和 Mongodb 部署 Graylog 环境。graylog 和 mongo 各 1 个 pod 和 ES 2 个 pod。
目前,我正在尝试将 mongodb 部署为任务和服务。我已经为此编写了一个脚本,但它没有按预期工作。
(已编辑)
有关我的 Kubernetes 集群的更多信息 -
- Kubernetes 集群运行在云服务器上。我使用
kubectl
命令从本地计算机连接以获取和执行基本操作。(将 kubeconfig 文件复制到我的本地机器以进行连接) - 我已经在我的本地机器上安装了 tekton cli。
当前场景- 我为我的 mongo 部署创建了一个任务和一个部署脚本。
这是我的简单部署脚本 -mongo-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo-deploy
labels:
service: mongo-deploy
spec:
replicas: 1
selector:
matchLabels:
service: mongo-deploy
template:
metadata:
labels:
service: mongo-deploy
spec:
containers:
- name: mongodb
image: mongo:4.2
ports:
- containerPort: 27017
---
apiVersion: v1
kind: Service
metadata:
name: mongo
spec:
selector:
service: mongo-deploy
ports:
- name: "27017"
port: 27017
targetPort: 27017
这是我的任务脚本-task-mongo-deploy.yaml
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: mongo-deploy
spec:
steps:
- name: mongo-deploy
image: mongo:4.2
command: [echo -----------------------------------]
args:
- |-
kubectl apply -f /path-to-location/tekton-scripts/mongo-deploy.yaml
echo -----------------------------------
我执行的步骤 -
kubectl apply -f task-mongo-deploy.yaml
tkn task start mongo-deploy
- 这是我的输出 -
$ tkn task start mongo-deploy
TaskRun started: mongo-deploy-run-mdblw
In order to track the TaskRun progress run:
tkn taskrun logs mongo-deploy-run-mdblw -f -n default
$ tkn taskrun logs mongo-deploy-run-mdblw -f -n default
task mongo-deploy has failed: "step-mongo-deploy" exited with code 1 (image: "docker-pullable://mongo@sha256:5c3059c8191861aaf766ce1ac592ebb42ea71ff13951701049bca93e8d614f96"); for logs run: kubectl -n default logs mongo-deploy-run-mdblw-pod-6fgkc -c step-mongo-deploy
[mongo-deploy] 2021/06/04 14:53:37 Error executing command: exec: "echo -----------------------------------": executable file not found in $PATH
container step-mongo-deploy has failed : [{"key":"StartedAt","value":"2021-06-04T14:53:37.297Z","type":"InternalTektonResult"}]
它仍然没有运行。知道我哪里出错了吗?