Kubernetes Example

This example show how to deploy the Prince of Persia Game in your namespace.
1. Create Deployment
Create a file prince-deployment.yaml with this example :
apiVersion: v1
kind: Service
metadata:
name: service-jeu-prince
namespace: mynamespace
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: jeu-prince ---
kind: Deployment
apiVersion: apps/v1
metadata:
name: jeu-prince
namespace: mynamespace
labels:
app: jeu-prince
spec:
replicas: 2
selector:
matchLabels:
app: jeu-prince
template:
metadata:
labels:
app: jeu-prince
spec:
containers:
- image: proxy-docker.amp-prod-repo-artifacts.equant.com/docker-princeofp:1.0.0
name: jeu-prince
ports:
- name: http
containerPort: 80
resources:
requests:
memory: "50Mi"
cpu: "1m"
limits :
memory: "100Mi"
cpu: "1"
$
$ kubectl apply -f prince-deployment.yaml $ kubectl get pods -n mynamespace

Step 2 : Expose your Service via Ingress

--- apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: jeu-prince namespace: mynamespace annotations: kubernetes.io/ingress.class: "nginx-noprod" nginx.ingress.kubernetes.io/rewrite-target: / prometheus.io/probe: "true" spec: rules: - host: prince.<mynamespace>.caas-cnp-apps-noprod.com.intraorange http: paths: - path: / backend: serviceName: service-jeu-prince servicePort: 80
$ kubectl apply -f prince-ingress.yaml

Go on http://prince.<mynamespace>.caas-cnp-apps-noprod.com.intraorange and play !

Comments

Popular posts from this blog

Microservice Pattern: SAGA

Microservice Pattern: Database per service Context

SQL vs NoSQL | Difference between SQL & NoSQL | SQL Vs NoSQL Tutorial | SQL, NoSQL system design