adding kujbernetes

This commit is contained in:
areeqakbr 2025-02-26 10:16:11 +07:00
parent 99f6010e01
commit d06e3fb7f8
1 changed files with 5 additions and 29 deletions

34
Jenkinsfile vendored
View File

@ -81,36 +81,10 @@ spec:
} }
} }
stage('Testing Network to Kubernetes') {
steps {
container('kubectl') {
withCredentials([string(credentialsId: 'a03aac83-cfb5-462c-af9e-c0904ea4be9b', variable: 'KUBE_TOKEN')]) {
sh '''
kubectl --server=https://console.kube.winteraccess.id/api/endpoints/1/kubernetes \
--token=$KUBE_TOKEN \
--kubeconfig=/dev/null \
get nodes
'''
}
}
}
}
stage('Debug Kubernetes') {
steps {
container('kubectl') {
sh '''
kubectl get pods --all-namespaces
'''
}
}
}
stage('Deploy to Kubernetes') { stage('Deploy to Kubernetes') {
steps { steps {
container('kubectl') { // ✅ Ensures `kubectl` runs in the correct container container('kubectl') { // ✅ Runs kubectl inside the correct container
withKubeConfig([credentialsId: "${KUBE_CONFIG_ID}"]) { withKubeConfig([credentialsId: '1c8bd8d9-1590-468c-afc7-24495d4330dc']) { // ✅ Uses the Jenkins credential
sh ''' sh '''
set -e set -e
kubectl apply -f deploy/kubernetes/ --validate=true kubectl apply -f deploy/kubernetes/ --validate=true
@ -119,6 +93,8 @@ spec:
} }
} }
} }
} }
post { post {