All instructions on creating a deployment (k8s) of a nodejs app.
There are 2 ways to create this cluster
k create deployment k8s-web-hello --image=dmaax/k8s-hello-from-express
k scale deployment k8s-web-hello --replicas=10
There are 3 ways to expose this deployment
k expose deployment k8s-web-hello --port=80 --target-port=3000
k expose deployment k8s-web-hello --type=NodePort --port=3000
k expose deployment k8s-web-hello --type=LoadBalancer --port=3000
k set image deployment k8s-web-hello k8s-hello-from-express=dmaax/k8s-hello-from-express:1.0.0
k rollout status deploy k8s-web-hello
k delete pod k8s-web-hello-6fb86f54fd-8ldcq
This pod is going to be recreated automatically, with another name.
minikube dashboard
This method may vary, this works if you're using minikube like me.
k apply -f k8s/deployment.yaml
Modify the deployment file, under "spec" add or modify a field called "replicas" and set a number. After that, apply the changes:
k apply -f k8s/deployment.yaml
k apply -f k8s/service.yaml
If you want to modify the type (ClusterIP, NodePort, LoadBalancer), under "spec" change the field "type". Afer that apply the changes:
k apply -f k8s/service.yaml
k delete -f k8s/deployment.yaml
If you want to delete the service use service.yaml.
k delete -f k8s/deployment.yaml -f k8s/service.yaml