我一直在GKE上设置一个带有flux的webhook接收器,我遵循了本指南的说明。根据它,我需要部署Git存储库接收器,如下所示:
apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
name: webapp
namespace: flux-system
spec:
type: github
events:
- "ping"
- "push"
secretRef:
name: webhook-token
resources:
- kind: GitRepository
name: webapp
当我在k8s版本1.18.12的gke集群上应用相同的操作时,我得到以下错误
prkumar@cloudshell:~ (portworx-eng)$ kubectl apply -f GitRepository.yml
error: unable to recognize "GitRepository.yml": no matches for kind "Receiver" in version "notification.toolkit.fluxcd.io/v1beta1"
我试着检查CRD是否存在,但我找不到任何东西:
prkumar@cloudshell:~ (portworx-eng)$ kubectl get customresourcedefinitions --all-namespaces
NAME CREATED AT
actionapprovals.autopilot.libopenstorage.org 2021-02-15T16:22:04Z
applicationbackups.stork.libopenstorage.org 2021-02-15T16:22:32Z
applicationbackupschedules.stork.libopenstorage.org 2021-02-15T16:22:47Z
applicationclones.stork.libopenstorage.org 2021-02-15T16:22:42Z
applicationregistrations.stork.libopenstorage.org 2021-02-15T16:22:27Z
applicationrestores.stork.libopenstorage.org 2021-02-15T16:22:37Z
autopilotruleobjects.autopilot.libopenstorage.org 2021-02-15T16:21:59Z
autopilotrules.autopilot.libopenstorage.org 2021-02-15T16:21:59Z
backendconfigs.cloud.google.com 2021-02-15T15:35:57Z
backuplocations.stork.libopenstorage.org 2021-02-15T16:22:22Z
clusterdomainsstatuses.stork.libopenstorage.org 2021-02-15T16:22:12Z
clusterdomainupdates.stork.libopenstorage.org 2021-02-15T16:22:17Z
clusterpairs.stork.libopenstorage.org 2021-02-15T16:21:57Z
frontendconfigs.networking.gke.io 2021-02-15T15:35:59Z
groupvolumesnapshots.stork.libopenstorage.org 2021-02-15T16:21:51Z
managedcertificates.networking.gke.io 2021-02-15T15:35:22Z
migrations.stork.libopenstorage.org 2021-02-15T16:22:02Z
migrationschedules.stork.libopenstorage.org 2021-02-15T16:22:07Z
rules.stork.libopenstorage.org 2021-02-15T16:21:31Z
schedulepolicies.stork.libopenstorage.org 2021-02-15T16:21:36Z
servicenetworkendpointgroups.networking.gke.io 2021-02-15T15:35:59Z
storagestates.migration.k8s.io 2021-02-15T15:35:26Z
storageversionmigrations.migration.k8s.io 2021-02-15T15:35:26Z
updateinfos.nodemanagement.gke.io 2021-02-15T15:35:27Z
volumeplacementstrategies.portworx.io 2021-02-15T16:20:24Z
volumesnapshotclasses.snapshot.storage.k8s.io 2021-02-15T15:35:25Z
volumesnapshotcontents.snapshot.storage.k8s.io 2021-02-15T15:35:25Z
volumesnapshotdatas.volumesnapshot.external-storage.k8s.io 2021-02-15T16:21:41Z
volumesnapshotrestores.stork.libopenstorage.org 2021-02-15T16:21:46Z
volumesnapshots.snapshot.storage.k8s.io 2021-02-15T15:35:25Z
volumesnapshots.volumesnapshot.external-storage.k8s.io 2021-02-15T16:21:41Z
volumesnapshotschedules.stork.libopenstorage.org 2021-02-15T16:21:41Z
prkumar@cloudshell:~ (portworx-eng)$
豆荚
prkumar@cloudshell:~ (portworx-eng)$ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
demo podinfo-58df84dbff-4wcl4 1/1 Running 0 9h
demo podinfo-58df84dbff-54rbg 1/1 Running 0 9h
flux flux-86845fff46-p6bdz 1/1 Running 0 9h
flux memcached-5bd7849b84-k4g2h 1/1 Running 0 9h
kube-system autopilot-859d58c8c4-x59b6 1/1 Running 0 10h
kube-system event-exporter-gke-564fb97f9-2l4fp 2/2 Running 0 10h
kube-system fluentbit-gke-j42rm 2/2 Running 0 10h
kube-system fluentbit-gke-ngv2c 2/2 Running 0 10h
kube-system fluentbit-gke-zqjk4 2/2 Running 0 10h
kube-system gke-metrics-agent-n7255 1/1 Running 0 10h
kube-system gke-metrics-agent-rbc2b 1/1 Running 1 10h
kube-system gke-metrics-agent-wmndz 1/1 Running 0 10h
kube-system kube-dns-6bd88c9b66-dtn5c 4/4 Running 0 10h
kube-system kube-dns-6bd88c9b66-jkq6w 4/4 Running 0 10h
kube-system kube-dns-autoscaler-7f89fb6b79-6bbn2 1/1 Running 0 10h
kube-system kube-proxy-gke-prashanth-cluster-te-default-pool-28f88aed-0jhg 1/1 Running 0 10h
kube-system kube-proxy-gke-prashanth-cluster-te-default-pool-28f88aed-3k7t 1/1 Running 0 10h
kube-system kube-proxy-gke-prashanth-cluster-te-default-pool-28f88aed-hrxd 1/1 Running 0 10h
kube-system l7-default-backend-7fd66b8b88-7h8jj 1/1 Running 0 10h
欢迎任何帮助或建议。
塞拉
问题与未安装的flux工具包有关。下面链接的文档帮助我解决了这个问题。https://github.com/fluxcd/kustomize-controller
根据文档,您的清单似乎是错误的。
要部署一个带有Webhook receiver的Git仓库,你必须记住:
In order to receive Git push or Helm chart upload events, you'll have to expose the
webhook receiver endpoint outside of your Kubernetes cluster on a public address.
flux文档建议你这样做:
- 创建LoadBalancer服务
- 向它传递一个公共地址。 定义一个Git仓库。
- 定义一个Git存储库接收器。
你可以在这个文档的链接中一步一步地配置你的文件。