在k8s集群以session模块部署flink

Flink On K8S

  1. 在需要安装的集群上执行

    wget --no-check-certificate https://dlcdn.apache.org/flink/flink-1.15.3/
    

​ 下载flink1.15.3版本

  1. 执行以下命令解压文件

    tar zxvf flink-1.15.3-bin-scala_2.12.tgz 
    
  2. 配置kubectl yum源,安装kubectl,将访问k8s集群证书拷贝到/root/.kube目录下

    cat <<EOF > /etc/yum.repos.d/kubernetes.repo
    [kubernetes]
    name=Kubernetes
    baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
    enabled=1
    gpgcheck=1
    repo_gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
    EOF
    yum install kubectl
    
  3. flink文件夹下执行以下命令部署session模式的flink,具体参数参考文档https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/deployment/config/#kubernetes-container-image-pull-secrets

    # 提前为flink创建好k8s的service account
    kubectl -n cvis-crossroad-dev create serviceaccount flink-service-account
    # 为flink账号绑定访问权限
    kubectl create clusterrolebinding flink-role-binding-flink --clusterrole=edit --serviceaccount=cvis-crossroad-dev:flink-service-account
    #创建session模式的flink服务
    ./bin/kubernetes-session.sh     -Dkubernetes.cluster-id=cvis-my-first-flink-cluster     -Dexecution.attached=true -Dkubernetes.namespace=cvis-crossroad-dev -Dkubernetes.service-account="flink-service-account"
    

你可能感兴趣的:(云原生,K8S,kubernetes,flink,容器)