[caasp-beta] How-To: LoadBalancer - Access to Dashboard as Example
Alejandro Bonilla
abonilla at suse.com
Wed Apr 12 10:20:32 MDT 2017
Hi Beta Testers -
(Before you proceed, please refer to my previous e-mail, "A few How-To guides coming your way”)
---
If you’ve deployed Beta 2 and then created a sample deployment, you’ll notice that a LoadBalancer would be nice in order to access containers easily.
Clearly, doing this to access the Kubernetes Dashboard (or any other service) isn’t that nice...
kubectl describe pods kubernetes-dashboard --namespace=kube-system | grep Node
kubectl describe svc kubernetes-dashboard --namespace=kube-system | grep Node
(Mix the IP+Port) = Dashboard URL
So, I’ve just tried using a (known, good for testing) LB that is available.
https://github.com/hpcloud/kubernetes-service-loadbalancer
Let’s give this LoadBalancer a try, and let’s use the (upstream) Kubernetes Dashboard as an example App.
1. Deploy the Kubernetes Dashboard.
kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
2. Fetch the necessary files to deploy the LoadBalancer
git clone https://github.com/hpcloud/kubernetes-service-loadbalancer.git
3. Enter the work directory
cd kubernetes-service-loadbalancer
4. Edit the ReplicationController section and change the VIP_ALLOCATION_START and VIP_ALLOCATION_END values. (Using an IP range to expose the App - In the same network as the master/workers)
vi examples/kube-loadbalancer-rc.yaml
5. And deploy the LB Controller we’ve just modified
kubectl create -f examples/kube-loadbalancer-rc.yaml
6. Get the worker node names and give them the type=loadbalancer label
kubectl get nodes
kubectl label node worker1 type=loadbalancer
kubectl label node worker2 type=loadbalancer
7. Create a configmap file to use the kube-LoadBalancer to expose the Kubernetes Dashboard and the content below (or use attached)
vi examples/dashboard-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: configmap-dashboard-svc
labels:
app: loadbalancer
data:
namespace: "kube-system"
target-service-name: "kubernetes-dashboard"
8. Deploy the configmap
kubectl create -f examples/dashboard-configmap.yaml
9. Get the Dashboard IP via the bind-ip
kubectl get configmap configmap-dashboard-svc -o yaml
10. curl or use a Browser to open the bind-ip.
Please let me know if something went wrong… or right…
Thanks,
Alejandro Bonilla
SUSE
Technical Strategist – North America
abonilla at suse.com
(484)426-7722
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dashboard-configmap.yaml
Type: application/octet-stream
Size: 201 bytes
Desc: dashboard-configmap.yaml
URL: <http://lists.suse.com/pipermail/caasp-beta/attachments/20170412/62577c57/attachment.dll>
More information about the caasp-beta
mailing list