I spent part of my weekend figuring out how to deploy on EKS. And I figured out!
First apply this config to your kubernetes cluster:
https://github.com/alegarciadelrio/kubernetes/blob/main/service-account-for-eks-azure-devops/1-service-account.yml
Then, add the resource on Environments:
Use the following commands to complete the fields:
kubectl config view --minify -o jsonpath={.clusters[0].cluster.server}
kubectl get secret deploy-robot-secret -n default -o json
Use the following pipeline
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: Deploy
displayName: Deploy Stage
jobs:
- deployment: Deploy
displayName: Deploy Nginx to EKS
environment:
name: 'development'
resourceName: 'default'
resourceType: Kubernetes
strategy:
runOnce:
deploy:
steps:
- checkout: self # Get your repository files
fetchDepth: 1
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo "Checking if manifest exists:"
ls -la $(Build.SourcesDirectory)/manifests
- task: Kubernetes@1
inputs:
command: 'apply'
useConfigurationFile: true
configuration: '$(Build.SourcesDirectory)/manifests/webapp-hello-v1.yml'
- task: Kubernetes@1
inputs:
command: 'apply'
useConfigurationFile: true
configuration: '$(Build.SourcesDirectory)/manifests/webapp-hello-service-v1.yml'
No hay comentarios:
Publicar un comentario