实验环境
Ubuntu 20.04
Kubernetes v1.20(单节点)
Knative v0.20.0
apt-get update
apt-get install -y apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io
service docker start
(Knative 需要 Kubernetes v1.17 以上的版本)
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload
systemctl restart docker
swapoff -a
kubeadm init --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl taint nodes --all node-role.kubernetes.io/master-
Knative 扩展了 Kubernetes,为开发人员提供了一套工具,可简化部署和管理可在任何地方运行的事件驱动应用程序的过程。
Knative有两个组件,可以独立安装或一起使用。
参考: https://knative.dev/docs/install/any-kubernetes-cluster/
架构: https://knative.dev/docs/serving/
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.20.0/serving-crds.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.20.0/serving-core.yaml
参考: https://knative.dev/docs/install/installing-istio/
部署需求: istioctl (v1.7 or later) installed.
目前官方建议部署istio v1.7
Installing Istio without sidecar injection
cat << EOF > ./istio-minimal-operator.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
values:
global:
proxy:
autoInject: disabled
useMCP: false
# The third-party-jwt is not enabled on all k8s.
# See: https://istio.io/docs/ops/best-practices/security/#configure-third-party-service-account-tokens
jwtPolicy: first-party-jwt
addonComponents:
pilot:
enabled: true
components:
ingressGateways:
- name: istio-ingressgateway
enabled: true
EOF
istioctl install -f istio-minimal-operator.yaml
kubectl apply --filename https://github.com/knative/net-istio/releases/download/v0.20.0/release.yaml
kubectl --namespace istio-system get service istio-ingressgateway
Configure DNS
注意:This will only work if the cluster LoadBalancer service exposes an IPv4 address or hostname, so it will not work with IPv6 clusters or local setups like Minikube. For these, see “Real DNS” or “Temporary DNS”.
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.20.0/serving-default-domain.yaml
最基本的Knative Serving部署完成。
>>: Day 11: 协作、团队与专案、学徒期 (待改进中... )
学习目标 这一篇是纪录阅读官方文件 Add services 的笔记内容。 本篇的内容是接续 Day...
Samantha和Theodore在一起的时候,时常提及自己在写钢琴曲,灵感来自於和Theodore...
前言 上一篇中我们学习到了 GenericAPIView 以及 Mixins 的使用,让我们建立 R...
「钱多事少离家近、睡觉睡到自然醒、位高权重责任轻;老板说话不用听、五年就领退休金、领钱领到手抽筋。」...
现在,你应该有了一个能妥善处理各种意外情形。 且能妥善引导使用者满足他们主要需求的对话流了。 在今...