当前位置:网站首页>A preliminary study of knative

A preliminary study of knative

2020-12-08 13:45:08 Jieyi

  • knative It's more popular serverless frame , At present, the main companies involved are Google、Pivotal、IBM、Red Hat, At present, the iteration is very fast
  • knative It's based on kubernetes and istio On platform , Use kubernetes Container management capabilities provided (deployment、replicaset、 and pods etc. ), as well as istio Provides network management functions (ingress、LB、dynamic route etc. )
  • contrast kubeless,knative Faster development , Big companies support more
  • Installation environment kubernetes-1.19.* knative-0.19 istio-1.7.5
  • install knative https://knative.dev/docs/install/any-kubernetes-cluster/
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.19.0/serving-crds.yaml
kubectl apply --filename https://github.com/knative/serving/releases/download/v0.19.0/serving-core.yaml
curl -L https://istio.io/downloadIstio | ISTIO_VERSION=1.7.5 TARGET_ARCH=x86_64 sh -
cd istio-1.7.5
export PATH=$PWD/bin:$PATH
  • adopt Istio Operator To install
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
    prometheus:
      enabled: false

  components:
    ingressGateways:
      - name: istio-ingressgateway
        enabled: true
      - name: cluster-local-gateway
        enabled: true
        label:
          istio: cluster-local-gateway
          app: cluster-local-gateway
        k8s:
          service:
            type: ClusterIP
            ports:
            - port: 15020
              name: status-port
            - port: 80
              targetPort: 8080
              name: http2
            - port: 443
              targetPort: 8443
              name: https
EOF

istioctl install -f istio-minimal-operator.yaml
  • Using Istio mTLS feature
kubectl create ns knative-serving
kubectl label namespace knative-serving istio-injection=enabled
  • Set PeerAuthentication to PERMISSIVE on knative-serving system namespace.
cat <<EOF | kubectl apply -f -
apiVersion: "security.istio.io/v1beta1"
kind: "PeerAuthentication"
metadata:
  name: "default"
  namespace: "knative-serving"
spec:
  mtls:
    mode: PERMISSIVE
EOF
  • Install the Knative Istio controller
kubectl apply --filename https://github.com/knative/net-istio/releases/download/v0.19.0/release.yaml

-- Check the installed version

kubectl get namespace knative-serving -o 'go-template={{index .metadata.labels "serving.knative.dev/release"}}'
kn service create helloworld-go --image gcr.io/knative-samples/helloworld-go --env TARGET="Go Sample v2"
kubectl edit cm config-domain --namespace knative-serving

Changed to the following

apiVersion: v1
data:
  mydomain.com: ""
kind: ConfigMap
[...]
  • Domain name resolution , add to *.default To A On record
*.default.mydomain.com                   59     IN     A   35.237.28.44
  • visit

版权声明
本文为[Jieyi]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201208134412333p.html