## 創建 k8s 登入帳號 1. 創建登入帳號 ```yaml= kubectl create serviceaccount azure-pipelines-deploy ``` 2. 創建包含令牌憑據的 Kubernetes Secret ```yaml= kubectl create secret generic azure-pipelines-deploy-token --type=kubernetes.io/service-account-token --dry-run=client -o yaml \ | kubectl annotate --local -o yaml -f - kubernetes.io/service-account.name=azure-pipelines-deploy \ | kubectl apply -f - ``` 3. 通過創建集群角色绑定將 cluster-admin 角色分配给服務帳號 ```yaml= kubectl create clusterrolebinding azure-pipelines-deploy --clusterrole=cluster-admin --serviceaccount=default:azure-pipelines-deploy ``` 4. 取得外部 ip  5. 取得 token ```yaml= kubectl get secret azure-pipelines-deploy-token -o yaml > azure-pipelines-deploy-token.yaml ``` ## 創建 azure 連線 1. 在 {porject}/Settings/Service connections 內點選 New service connection  2. 選擇 Kubernetes,點選 Next  3. 輸入 Kubernetse 參數 1. Authentication method 選擇 service Account 2. Server Url 輸入 Kubernetes Cluster ip 3. Secret 輸入 Kubernetes 創建的使用者 token 4. Service connection name 輸入顯示的連線名稱 5. 點選 save  ## 參考資料 [google](https://cloud.google.com/dotnet/docs/creating-cicd-pipeline-vsts-kubernetes-engine?hl=zh-cn#deploying_continuously)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up