knative 安装
knative 安装
本文安装版本 knative 0.6。
准备
安装 knative 前需要事先安装 Kubernetes 集群 和 Istio。
安装
下载安装所需要的文件。以下选择的是全安装,如果不想要 knative 的全部功能,可自行选择不需要的 yaml。由于所有的镜像都是来自墙外,需要科 学上网。
cd /opt;mkdir knative;cd knative
wget https://github.com/knative/serving/releases/download/v0.6.0/serving.yaml
wget https://github.com/knative/build/releases/download/v0.6.0/build.yaml
wget https://github.com/knative/eventing/releases/download/v0.6.0/release.yaml
wget https://github.com/knative/eventing-sources/releases/download/v0.6.0/eventing-sources.yaml
wget https://github.com/knative/serving/releases/download/v0.6.0/monitoring.yaml
wget https://raw.githubusercontent.com/knative/serving/v0.6.0/third_party/config/build/clusterrole.yaml
安装 CRD。
kubectl apply --selector knative.dev/crd-install=true -f .
安装服务。
kubectl apply -f serving.yaml --selector networking.knative.dev/certificate-provider!=cert-manager \
-f build.yaml -f release.yaml -f eventing-sources.yaml \
-f monitoring.yaml -f clusterrole.yaml
查看 knative 的组件是否已全部就绪(处于 running 或 Completed 状态)。
kubectl get pods -n knative-serving
kubectl get pods -n knative-build
kubectl get pods -n knative-eventing
kubectl get pods -n knative-sources
kubectl get pods -n knative-monitoring
也可以用 watch 方式实时查看是否已就绪。
kubectl get pods --all-namespaces --watch | grep -E "knative-serving|knative-build|knative-eventing|knative-sources|knative-monitoring"
在安装过程中可能会碰到很多 pod 处于 pending 状态,一般都是由于资源不够导致。
自制镜像安装
由于很多镜像来自墙外,在国内不能愉快的玩耍。这就需要自制镜像。具体过程可看自制镜像。
下面是 knative 0.6 里需要用到的镜像,我这里已经自制完成,可直接下载
[root@test-1 download]# cat down.sh
#!/bin/bash
down_docker=(
mathlsj/knative-serving-cmd-webhook:0.6
mathlsj/knative-serving-cmd-networking-istio:0.6
mathlsj/knative-serving-cmd-networking-certmanager:0.6
mathlsj/knative-serving-cmd-controller:0.6
mathlsj/knative-serving-cmd-queue:0.6
mathlsj/knative-serving-cmd-autoscaler:0.6
mathlsj/knative-serving-cmd-activator:0.6
mathlsj/knative-eventing-cmd-apiserver_receive_adapter:0.6
mathlsj/knative-eventing-cmd-broker-filter:0.6
mathlsj/knative-eventing-cmd-broker-ingress:0.6
mathlsj/knative-eventing-cmd-controller:0.6
mathlsj/knative-eventing-cmd-cronjob_receive_adapter:0.6
mathlsj/knative-eventing-cmd-in_memory-controller:0.6
mathlsj/knative-eventing-cmd-in_memory-dispatcher:0.6
mathlsj/knative-eventing-cmd-sources_controller:0.6
mathlsj/knative-eventing-cmd-webhook:0.6
mathlsj/knative-eventing-sources-cmd-github_receive_adapter:0.6
mathlsj/knative-eventing-sources-cmd-manager:0.6
mathlsj/knative-build-cmd-controller:0.6
mathlsj/knative-build-cmd-creds-init:0.6
mathlsj/knative-build-cmd-git-init:0.6
mathlsj/knative-build-cmd-nop:0.6
mathlsj/knative-build-cmd-webhook:0.6
)
down_other=(
mathlsj/knative-addon-resizer:1.7
mathlsj/knative-elasticsearch:v5.6.4
mathlsj/knative-fluentd-elasticsearch:v2.0.4
mathlsj/knative-cloud-builders-gcs-fetcher:0.6
)
for var in ${down_docker[@]};do
docker pull $var
done
for var_other in ${down_other[@]};do
docker pull $var_other
done
自制镜像完成后,knative 的镜像是用 sha256 方式来 pull的。在本地我们不能通过 docker tag 的方式重新打包,只能修改 yaml 里的所有配置。配置修改后 yaml 文件已放在 github 上,有需要的大家自己下载。github地址。
配置文件修改完后,后继的操作和原安装步骤一样。