$ kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.27.240.1 <none> 443/TCP 22h mycache-memcached ClusterIP None <none> 11211/TCP 21h
What we need to do now is expose that mycache-memcached service to the outside world. For that we need to attach a loadbalancer service.
$ kubectl expose service mycache-memcached --port=11211 --target-port=11211 --name=mc --type=LoadBalancer
After a little while, we’ll see this new Loadbalancer created with a public IP address assigned. It can take a few minutes to complete.
$ kubectl get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.27.240.1 <none> 443/TCP 23h mc LoadBalancer 10.27.244.1 35.xxx.xxx.xxx 11211:30588/TCP 47s mycache-memcached ClusterIP None <none> 11211/TCP 22h
You can now access your memcache service on the given IP address and port number. I should remind you that this service is now public and accessible so be careful how you use it. I won’t bother with it for this demo, but if you are interested in how to use ssl with Kubernetes, see HTTPS ingress for Kubernetes service
Testing memcache from outside the cluster by creating a test apps for memcache on Kubernetes
Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.