Skip to content

Gekd/Kubernetes

Repository files navigation

K8s ClusterF*

An e-commerce service deployable to a Kubernetes.

Deploy

  • start minikube
  • open dashboard

Apply Configs

Apply Directory

kubectl apply -f k8s-configs/

or

Apply Separately

kubectl apply -f .\deployment-identity-service.yaml
kubectl apply -f .\service-identity-service.yaml
# etc

Apply Ingress Config

kubectl apply -f ingress.yaml

Get Minikube ip

This ip can be added to hosts file with local.microservices (can be configured in ingerss.yaml).

minikube ip

Now you can access the service at http://local.microservices/login

Commands (for debugging and development)

Set up Minikube, download ingress addon and Open Dashboard

minikube start
minikube addons enable ingress
minikube dashboard

Create Minikube Docker Env

minikube docker-env

Enter Minikube Docker Env

& minikube -p minikube docker-env --shell powershell | Invoke-Expression

See Active Services

kubectl get services

Build Docker Image

docker build -t <image-name> .

Run Pod

kubectl run <pod-name> --image=<image-name> --image-pull-policy=Never --restart=Never

Expose Pod Port

kubectl expose pod <pod-name> --type=LoadBalancer --port=3000 --target-port=3000

Edit Running Service Configuration (i.e Change port) (opens Text editor)

kubectl edit service product-service-container

Create Minikube Tunnel (gives Loadbalancer Services an External Ip)

see [[#See Active Services]] to get the external ip

minikube tunnel

Using Dockerhub

Creating Tag

docker tag identity-server:latest chirbard/k8-ecom-identity-service:latest

Pushing to Hub

docker push chirbard/k8-ecom-identity-service:latest

About

We learn containers, vist?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published