diff --git a/kubernetes.runapp b/kubernetes.runapp new file mode 100644 index 0000000..83e7a76 --- /dev/null +++ b/kubernetes.runapp @@ -0,0 +1,62 @@ +running application on kubernetes: + +[ger@master ~]$ kubectl get nodes +NAME STATUS ROLES AGE VERSION +master.ger.test Ready master 7d1h v1.12.1 +worker1.ger.test Ready worker 7d1h v1.12.1 +worker2.ger.test Ready worker 7d1h v1.12.1 + +create deployment nginx: + +[ger@master ~]$ kubectl run nginx --image nginx --port 80 +kubectl run --generator=deployment/apps.v1beta1 is DEPRECATED and will be removed in a future version. Use kubectl create instead. +deployment.apps/nginx created + +create service nginx and expose port 80: + +[ger@master ~]$ kubectl expose deploy nginx --port 80 --target-port 80 --type NodePort +service/nginx exposed + +[ger@master ~]$ kubectl get services +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +kubernetes ClusterIP 10.96.0.1 443/TCP 7d1h +nginx NodePort 10.109.244.16 80:32368/TCP 71s + +port 80 nginx is now exposed on one of the nodes on port 32368: + +[ger@master ~]$ curl worker2.ger.test:32368 + + + +

Welcome to nginx!

+

If you see this page, the nginx web server is successfully installed and +working. Further configuration is required.

+ +

For online documentation and support please refer to +nginx.org.
+Commercial support is available at +nginx.com.

+ +

Thank you for using nginx.

+ + + +cleanup: + +first delete service: + +[ger@master ~]$ kubectl delete service nginx +service "nginx" deleted + +[ger@master ~]$ kubectl get service +NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +kubernetes ClusterIP 10.96.0.1 443/TCP 7d1h + +then delete deployment: + +[ger@master ~]$ kubectl delete deployment nginx +deployment.extensions "nginx" deleted + +[ger@master ~]$ kubectl get deployment +No resources found. +