This is a simple demo which deployment spring-boot application on kubernetes cluster.
-
Start the k8s cluster.
-
minikube start
-
Create our first pod.
kubectl create deployment k8s-demo --image=isalemnabeel/k8s-demo
kubectl get pods
kubectl get deployments
kubectl describe pod k8s-demo
-
Lunch k8s dashboard.
minikube dashboard
-
Lunch k8s tunnel.
minikube tunnel
-
Expose Deployment.
kubectl expose deployment k8s-demo-deployment --name=k8s-demo-service --port=9409 --target-port=9409 --type=LoadBalancer
-
Open your browser:
apiVersion: apps/v1
kind: Deployment
metadata:
name: k8s-demo-deployment
labels:
app: k8s-demo
spec:
replicas: 1
selector:
matchLabels:
app: k8s-demo
template:
metadata:
labels:
app: k8s-demo
spec:
containers:
- name: k8s-demo
image: isalemnabeel/k8s-demo
ports:
- containerPort: 9409
kubectl apply -f k8s-demo-deployment.yaml
-
Lunch k8s dashboard.
minikube dashboard
-
Lunch k8s tunnel.
minikube tunnel
-
Expose Deployment.
kubectl expose deployment k8s-demo-deployment --name=k8s-demo-service --port=9409 --target-port=9409 --type=LoadBalancer
-
Open your browser: