I have installed Kind
for local Kubernetes deployment. I want to make a connection with Jenkins using the kube config file as a secret in Jenkins cloud but getting an error on Test Connection
Error testing connection : java.io.IOException: Failed to connect to /127.0.0.1:35439
kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://127.0.0.1:35439
name: kind-kind
contexts:
- context:
cluster: kind-kind
user: kind-kind
name: kind-kind
current-context: kind-kind
kind: Config
preferences: {}
users:
- name: kind-kind
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
but when I view file from this path cat ~.kube/config then getting this file with base64
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJek1Ea3hNakV4TlRJek1Gb1hEVE16TURrd09URXhOVEl6TUZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTlhUCnlzL3NPcVJpaVNLU0U0NjRhK3KKKhWTk43WUV6Wk1YdnhXejVWNGpJb3FZcHhtK3RDa2swVmZjbjkyenhJK0xzencKeG5tM2FMZTdvRnlTTVRRRRRMMMMR1VE51RGl5dTM3cko5aUNxWE5nd0lyMXI2Q2NTbXVVblRGMHBYMmM2bDI5WktsTGJZKwp6T2RManpUazE1NWxKQmNhTE5SaGF5RUNGNGRqdDlMekJFaGozUTJWbHNsSW5oelZxRWprNW9wU2dxaFc0dEs0CitsOVBJVi9zNVFjL0FFckNFTmc1TGtnT2U5VWM4THg2RGI1ZFQwYXZBU0RZNEY1ZE9zSDZmZlI0eTR3aTd1eTcKTWFwS0hKcmZoUFJMVjFralV4amJVUGtDZHVvd1ZyRHlLZWozZlpFcXdwZzJXekxjeWl5OWl4UFdOaVExQTZtYQppYmI0ZUpKemVVb0diN0hKeUJrQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZFSU0vMi9EcFRpRDNVQkZxdlNvTUlJdXZNRGtNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFBamdZSk9TdjBieGk2eVhWMmlqTkRzaFNyQkQ4WFlvT1hkSTBvZG0xTHdZYzFTa1MxRgpLSEFvcWJaWHR6bWVaZ2ZMN2JCY1IrOUx0aWIvMDZiem83OVpsSEpaQWx4T1ZZTmpvSXBLazJXdG4yWUdBN0w5CjlCdmFSYXU1S0NtVXlrVDRNanRKSHBSb0N6OTUxV0VJRCtyNkdDeklUV3Z4U2sxVFFtZGVKMGk5ck1qVTM4RlIKTXNwaGdNVmhJMjV3YTE1MFJMSk9kQ1JvbGpqTDFnUzFRMUEyaXk4azRYT0tmekxlenJMcFNaOXJnNzlMZ000YgpabVlVSkJndU4rUnJMSmZkZW9NQ01scWNzNkZoSmcvWXIrb2ZCdUtUeDdDMEhNNVJFL3JtYmY4WHBSSVZla25KCldxdUp5VTQ5Z2Rxa2dyWHQ2ZWhvb002WDU0ZnJNTmRySzViMAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://127.0.0.1:35439
name: kind-kind
contexts:
- context:
cluster: kind-kind
user: kind-kind
name: kind-kind
current-context: kind-kind
kind: Config
preferences: {}
users:
- name: kind-kind
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJUzRZOUJMN3V1TWN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TXpBNU1USXhNVFV5TXpCYUZ3MHlOREE1TVRFeE1UVXlNek5hTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHR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V1hMdy9ETmtieURnYgpiTUU3aGlzV0ZpU2FRdnQ4MnZQamxKc3I4M3lLRnZ0WnZ3eFVvVXJkc1FzY0wrWDhWamJTZmdCWkxVMExEN2svCjdWMThvUUtCZ0RvQVZsZHdZblJkbVdmcjRWZXRiRlVxQ2JWV3Z3UjR5RFpvSWVzdDRTMXJzY1ppTmNlVVEyMzUKd2xERVVRNHliT1daYXNDMUNHNlUyUnF6Q1JTZEpJbG00ZEFveTA1dzFOYmkkjkjdoSFJWOFdZZ0RNRWRnRDhoaXIwZgpZYVB5S3hURnAvZTNiYm85emZLNTFaMWprNWxwR3B0S3QzenhML2N6ejFXOEo4czJzTU9KCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
Due to this connection is not building with Jenkins through the cloud and I’m not able to run the Kubernetes command in the Jenkins File This is my Jenkins Deployment stage
stage('Deploying App to Kubernetes') {
steps {
// Use the kubeconfig credential ID that you added
withCredentials([file(credentialsId: 'k8s', variable: 'KUBECONFIG')]) {
sh 'curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.20.5/bin/linux/amd64/kubectl"'
sh 'chmod u+x ./kubectl'
sh './kubectl config get-contexts'
sh './kubectl get nodes'
sh './kubectl apply -f deploy/deployment.yaml'
sh './kubectl apply -f deploy/service.yaml'
sh './kubectl get svc'
sh './kubectl get deployments'
sh './kubectl get pods'
}
}
}
I have a master node with a kind
kind get clusters
kind
kubectl get nodes
NAME STATUS ROLES AGE VERSION
kind-control-plane Ready control-plane,master 18h v1.21.1
kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:35439
CoreDNS is running at https://127.0.0.1:35439/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
What could be the issue, I’m not able find the solution and i’m trying this for the last one days and I did not get the proper solution.