**Github Repository : ** https://github.com/Razorops-code/spring-boot.git
You can follow the these steps for creating IBM-cluster click here
After creating IBM-kubernetes cluster
To access a cluster using kubectl, you have to set up a Kubernetes configuration file (commonly known as a ‘kubeconfig’ file) for the cluster. The kubeconfig file (by default named config and stored in the $HOME/.kube directory) provides the necessary details to access the cluster. Having set up the kubeconfig file, you can start using kubectl to manage the cluster. For razorops you can follow the process to access the cluster Click here
After creating IBM-kubernetes-cluster successfully (Cluster name:- traing)
Next you navigate to existing cluster Here you can add name for cluster and authentication method Here we can go with kubernetes ConfigFile (which is generated by connect credentials )
luster added process completed next move to workflow section for run a pipeline for deploy our application on to kubernetes eks cluster
Next click on pipeline , you can navigate to the add a new pipeline dashboard
And confirm it
tasks:
build-job:
steps:
- checkout
- commands:
- |
mvn clean package # build the package
ls -a
ls target
- docker/build:
image: razoropsrepocode/spring # build the image with Dockerfile
push: true # push image to docker hub repository Which is integrated
tags: ["latest-v2"]
# kubernetes deployment
deploy-kubernetes:
when: branch == 'master' # only run if code is pushed to develop branch
depends: [build-job]
steps:
- checkout
- commands:
- |
kubectl create -f deployment.yml
kubectl create -f service.yml
kubectl get svc
deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample-java-app
spec:
replicas: 1
selector:
matchLabels:
app: java-app
template:
metadata:
labels:
app: java-app
spec:
containers:
- name: java-app
image: razoropsrepocode/spring:latest-v2
imagePullPolicy: Always
ports:
- containerPort: 8080
service.yml
apiVersion: v1
kind: Service
metadata:
name: sample-java-app
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
app: java-app
Successfully Sample-java-app pod up and running and works on NodePort-service- 30612
We can find
![]()