0

通过在 GKE 上设置一个带有通量的 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

非常欢迎任何帮助或建议。

-普拉桑特

4

2 回答 2

1

问题出在未安装的助焊剂工具包上。按照以下链接中的文档帮助我解决了这个问题。 https://github.com/fluxcd/kustomize-controller

于 2021-02-18T09:43:35.490 回答
0

根据文档,您的清单似乎是错误的。

要使用Webhook 接收器部署 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.

助焊剂文档建议您做的是:

  1. 创建一个 LoadBalancer 服务。
  2. 为它分配一个公共地址。
  3. 定义一个 Git 存储库。
  4. 定义一个 Git 存储库接收器。

您可以在文档的此链接中逐步按照文件的配置进行操作。

于 2021-02-17T13:28:41.720 回答