You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Pubudu Gunatilaka <pu...@wso2.com> on 2015/07/29 22:19:08 UTC

Introducing Kubernetes Service Types in Apache Stratos

Hi Devs,

Currently I am working on $subject. In Kubernetes there are 3 kinds of
services types. They are NodePort, ClusterIP and LoadBalancer [1]. At the
moment Stratos supports only NodePort type. My intention is to extend this
to have ClusterIP type as well.

*Why We Need ClusterIP*

1. NodePort type has limited number of ports. i.e 30000 to 32767.
2. There can be situations where we need to expose some ports for
communication between containers only. In this kind of situation we can use
ClusterIP type to save limited port numbers.

*Design Decisions *

1. When creating a cartridge for kubernetes, you need to specify the type
in PortMapping as either NodePort or ClusterIP. This should be done for
every port mapping defined in the cartridge for kubernetes.
2. If you have set the type as ClusterIP, Access URLs are not generated.

*Identified Improvements to be done in the future releases*

1. There is no mechanism to reuse already used port which is vacant.
2. Currently we generate a service for every port mapping. But a service
can have multiple port mappings. We can improve to have a single service
with multiple port mappings.


Please share your thoughts!

[1] -
https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/user-guide/services.md#external-services

Thank you!

-- 

*Pubudu Gunatilaka*
Software Engineer
WSO2, Inc.: http://wso2.com
lean.enterprise.middleware
mobile:  +94 77 4078049

Re: Introducing Kubernetes Service Types in Apache Stratos

Posted by Imesh Gunaratne <im...@apache.org>.
Great work Pubudu!

On Tue, Aug 4, 2015 at 2:32 PM, Pubudu Gunatilaka <pu...@wso2.com> wrote:

> Hi Devs,
>
> I have done the required change and PR can be found in [1]. It has now
> merged with the master branch. With this change when you are adding a
> cartridge which uses kubernetes Iaas, you need to provide another property
> called kubernetesPortType under the portMapping section. Acceptable values
> for this are NodePort and ClusterIP. Following is a sample for PortMapping.
>
> {
>
>     "name": "http-80",
>     "protocol": "http",
>     "port": "50070",
>     "proxyPort": "8281",
>     "kubernetesPortType":"NodePort"
> }
>
> Please note that we generate access URLs only for NodePort type.
>
> Thank you!
>
> [1] - https://github.com/apache/stratos/pull/415
>
> On Sun, Aug 2, 2015 at 5:13 PM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> Hi Pubudu,
>>
>> Yes please go ahead with this improvement. May be in the port mapping
>> definition the new property can be called "kubernetesPortType".
>>
>> Thanks
>>
>> On Thu, Jul 30, 2015 at 1:49 AM, Pubudu Gunatilaka <pu...@wso2.com>
>> wrote:
>>
>>> Hi Devs,
>>>
>>> Currently I am working on $subject. In Kubernetes there are 3 kinds of
>>> services types. They are NodePort, ClusterIP and LoadBalancer [1]. At the
>>> moment Stratos supports only NodePort type. My intention is to extend this
>>> to have ClusterIP type as well.
>>>
>>> *Why We Need ClusterIP*
>>>
>>> 1. NodePort type has limited number of ports. i.e 30000 to 32767.
>>> 2. There can be situations where we need to expose some ports for
>>> communication between containers only. In this kind of situation we can use
>>> ClusterIP type to save limited port numbers.
>>>
>>> *Design Decisions *
>>>
>>> 1. When creating a cartridge for kubernetes, you need to specify the
>>> type in PortMapping as either NodePort or ClusterIP. This should be done
>>> for every port mapping defined in the cartridge for kubernetes.
>>> 2. If you have set the type as ClusterIP, Access URLs are not generated.
>>>
>>> *Identified Improvements to be done in the future releases*
>>>
>>> 1. There is no mechanism to reuse already used port which is vacant.
>>> 2. Currently we generate a service for every port mapping. But a service
>>> can have multiple port mappings. We can improve to have a single service
>>> with multiple port mappings.
>>>
>>>
>>> Please share your thoughts!
>>>
>>> [1] -
>>> https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/user-guide/services.md#external-services
>>>
>>> Thank you!
>>>
>>> --
>>>
>>> *Pubudu Gunatilaka*
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean.enterprise.middleware
>>> mobile:  +94 77 4078049
>>>
>>
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Senior Technical Lead, WSO2
>> Committer & PMC Member, Apache Stratos
>>
>
>
>
> --
>
> *Pubudu Gunatilaka*
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean.enterprise.middleware
> mobile:  +94 77 4078049
>



-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

Re: Introducing Kubernetes Service Types in Apache Stratos

Posted by Pubudu Gunatilaka <pu...@wso2.com>.
Hi Devs,

I have done the required change and PR can be found in [1]. It has now
merged with the master branch. With this change when you are adding a
cartridge which uses kubernetes Iaas, you need to provide another property
called kubernetesPortType under the portMapping section. Acceptable values
for this are NodePort and ClusterIP. Following is a sample for PortMapping.

{

    "name": "http-80",
    "protocol": "http",
    "port": "50070",
    "proxyPort": "8281",
    "kubernetesPortType":"NodePort"
}

Please note that we generate access URLs only for NodePort type.

Thank you!

[1] - https://github.com/apache/stratos/pull/415

On Sun, Aug 2, 2015 at 5:13 PM, Imesh Gunaratne <im...@apache.org> wrote:

> Hi Pubudu,
>
> Yes please go ahead with this improvement. May be in the port mapping
> definition the new property can be called "kubernetesPortType".
>
> Thanks
>
> On Thu, Jul 30, 2015 at 1:49 AM, Pubudu Gunatilaka <pu...@wso2.com>
> wrote:
>
>> Hi Devs,
>>
>> Currently I am working on $subject. In Kubernetes there are 3 kinds of
>> services types. They are NodePort, ClusterIP and LoadBalancer [1]. At the
>> moment Stratos supports only NodePort type. My intention is to extend this
>> to have ClusterIP type as well.
>>
>> *Why We Need ClusterIP*
>>
>> 1. NodePort type has limited number of ports. i.e 30000 to 32767.
>> 2. There can be situations where we need to expose some ports for
>> communication between containers only. In this kind of situation we can use
>> ClusterIP type to save limited port numbers.
>>
>> *Design Decisions *
>>
>> 1. When creating a cartridge for kubernetes, you need to specify the type
>> in PortMapping as either NodePort or ClusterIP. This should be done for
>> every port mapping defined in the cartridge for kubernetes.
>> 2. If you have set the type as ClusterIP, Access URLs are not generated.
>>
>> *Identified Improvements to be done in the future releases*
>>
>> 1. There is no mechanism to reuse already used port which is vacant.
>> 2. Currently we generate a service for every port mapping. But a service
>> can have multiple port mappings. We can improve to have a single service
>> with multiple port mappings.
>>
>>
>> Please share your thoughts!
>>
>> [1] -
>> https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/user-guide/services.md#external-services
>>
>> Thank you!
>>
>> --
>>
>> *Pubudu Gunatilaka*
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean.enterprise.middleware
>> mobile:  +94 77 4078049
>>
>
>
>
> --
> Imesh Gunaratne
>
> Senior Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>



-- 

*Pubudu Gunatilaka*
Software Engineer
WSO2, Inc.: http://wso2.com
lean.enterprise.middleware
mobile:  +94 77 4078049

Re: Introducing Kubernetes Service Types in Apache Stratos

Posted by Imesh Gunaratne <im...@apache.org>.
Hi Pubudu,

Yes please go ahead with this improvement. May be in the port mapping
definition the new property can be called "kubernetesPortType".

Thanks

On Thu, Jul 30, 2015 at 1:49 AM, Pubudu Gunatilaka <pu...@wso2.com> wrote:

> Hi Devs,
>
> Currently I am working on $subject. In Kubernetes there are 3 kinds of
> services types. They are NodePort, ClusterIP and LoadBalancer [1]. At the
> moment Stratos supports only NodePort type. My intention is to extend this
> to have ClusterIP type as well.
>
> *Why We Need ClusterIP*
>
> 1. NodePort type has limited number of ports. i.e 30000 to 32767.
> 2. There can be situations where we need to expose some ports for
> communication between containers only. In this kind of situation we can use
> ClusterIP type to save limited port numbers.
>
> *Design Decisions *
>
> 1. When creating a cartridge for kubernetes, you need to specify the type
> in PortMapping as either NodePort or ClusterIP. This should be done for
> every port mapping defined in the cartridge for kubernetes.
> 2. If you have set the type as ClusterIP, Access URLs are not generated.
>
> *Identified Improvements to be done in the future releases*
>
> 1. There is no mechanism to reuse already used port which is vacant.
> 2. Currently we generate a service for every port mapping. But a service
> can have multiple port mappings. We can improve to have a single service
> with multiple port mappings.
>
>
> Please share your thoughts!
>
> [1] -
> https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/user-guide/services.md#external-services
>
> Thank you!
>
> --
>
> *Pubudu Gunatilaka*
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean.enterprise.middleware
> mobile:  +94 77 4078049
>



-- 
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos