63 lines
1.9 KiB
Plaintext
63 lines
1.9 KiB
Plaintext
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 <none> 443/TCP 7d1h
|
|
nginx NodePort 10.109.244.16 <none> 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
|
|
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<h1>Welcome to nginx!</h1>
|
|
<p>If you see this page, the nginx web server is successfully installed and
|
|
working. Further configuration is required.</p>
|
|
|
|
<p>For online documentation and support please refer to
|
|
<a href="http://nginx.org/">nginx.org</a>.<br/>
|
|
Commercial support is available at
|
|
<a href="http://nginx.com/">nginx.com</a>.</p>
|
|
|
|
<p><em>Thank you for using nginx.</em></p>
|
|
</body>
|
|
</html>
|
|
|
|
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 <none> 443/TCP 7d1h
|
|
|
|
then delete deployment:
|
|
|
|
[ger@master ~]$ kubectl delete deployment nginx
|
|
deployment.extensions "nginx" deleted
|
|
|
|
[ger@master ~]$ kubectl get deployment
|
|
No resources found.
|
|
|