Re: [kubernetes-users] Replication controller pod "adoption"

2017-08-07 Thread rgoncalves
Hi Rodrigo. 

If you look at the redis-master.yaml, there's a pod with the following labels:

metadata:
  labels:
name: redis
redis-sentinel: "true"
role: master


redis-controller.yaml describes a replication controller with selector: 
metadata:
  name: redis
spec:
  replicas: 1
  selector:
name: redis   

redis-sentinel-controller.yaml  describes a replication controller with 
selector: 
metadata:
  name: redis-sentinel
spec:
  replicas: 1
  selector:
redis-sentinel: "true"


Both replication controller selectors will match the first POD labels. Unless 
I'm misunderstanding something, here we have two replication controllers 
fighting for the same pod. This "arrangement" is convenient for setting up a 
redis cluster, because initially we have to set one redis instance as master 
explicitly. After that the cluster will take care of electing a new master if 
necessary.

Thanks,
Rui


-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] Replication controller pod "adoption"

2017-08-04 Thread Rodrigo Campos
Which replica controllers fight for the same pod, there?

Looking at the yamls, I don't see it :-/

On Thursday, August 3, 2017,  wrote:

> On Wednesday, August 2, 2017 at 3:35:45 PM UTC+1, Rodrigo Campos wrote:
> > On Wednesday, August 2, 2017,  >
> wrote:
> > Hi Rodrigo. Thanks for answering.
> >
> >
> >
> > Yes, you're right. I should not talk about the containers but pods.. let
> me give another example to clarify. Suppose we have the following resources:
> >
> >
> >
> > POD
> >
> > apiVersion: v1
> >
> > kind: Pod
> >
> > metadata:
> >
> >   labels:
> >
> > a: "1"
> >
> >   name: sample-pod
> >
> > spec:
> >
> >   containers:
> >
> > - name: sample-test-pod
> >
> >...
> >
> > -RC
> >
> > apiVersion: v1
> >
> > kind: ReplicationController
> >
> > metadata:
> >
> >   name: sample-rc1
> >
> > spec:
> >
> >   replicas: 1
> >
> >   selector:
> >
> > a: "1"
> >
> >   ...
> >
> > --
> >
> >
> >
> > After creating this two resources we have one single pod (sample-rc1
> "adopts" existing pod...nice). But, if we create another replication
> controller with the same selector, changing only the rc name (ex.
> sample-rc2), another pod is launched. Didn't expect this second pod
> instance...
> >
> >
> > Hmm, are you sure that is going to happen? If both RCs fight for their
> resources, it might even be unstable for a while but for sure not 2
> containers when there should be only 1.
>
> Yes, I'm sure... I've verified it with kubernetes 1.5.2 and 1.7.2.
> >
> >
> >
> >
> >
> > I know my scenario does not make much sense. However, in the tutorial
> mentioned above this
> >
> >
> >
> > Didn't see any tutorial. Can you please be more specific? :)
>
> https://github.com/kubernetes/examples/tree/master/staging/storage/redis
> >
> > happens and it's usage is at least reasonable.
> >
> >
> >
> > Having two RCs fight for their resources is not reasonable. I really
> doubt this is not a typo or something. Would be really weird.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Kubernetes user discussion and Q" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kubernetes-users+unsubscr...@googlegroups.com .
> To post to this group, send email to kubernetes-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] Replication controller pod "adoption"

2017-08-02 Thread Rodrigo Campos
On Wednesday, August 2, 2017,  wrote:

> Hi Rodrigo. Thanks for answering.
>
> Yes, you're right. I should not talk about the containers but pods.. let
> me give another example to clarify. Suppose we have the following resources:
>
> POD
> apiVersion: v1
> kind: Pod
> metadata:
>   labels:
> a: "1"
>   name: sample-pod
> spec:
>   containers:
> - name: sample-test-pod
>...
> -RC
> apiVersion: v1
> kind: ReplicationController
> metadata:
>   name: sample-rc1
> spec:
>   replicas: 1
>   selector:
> a: "1"
>   ...
> --
>
> After creating this two resources we have one single pod (sample-rc1
> "adopts" existing pod...nice). But, if we create another replication
> controller with the same selector, changing only the rc name (ex.
> sample-rc2), another pod is launched. Didn't expect this second pod
> instance...


Hmm, are you sure that is going to happen? If both RCs fight for their
resources, it might even be unstable for a while but for sure not 2
containers when there should be only 1.



>
> I know my scenario does not make much sense. However, in the tutorial
> mentioned above this


>
Didn't see any tutorial. Can you please be more specific? :)


>
>
happens and it's usage is at least reasonable.
>

Having two RCs fight for their resources is not reasonable. I really doubt
this is not a typo or something. Would be really weird.

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] Replication controller pod "adoption"

2017-08-02 Thread rgoncalves
Hi Rodrigo. Thanks for answering.

Yes, you're right. I should not talk about the containers but pods.. let me 
give another example to clarify. Suppose we have the following resources:

POD
apiVersion: v1
kind: Pod
metadata:
  labels:
a: "1"
  name: sample-pod
spec:
  containers:
- name: sample-test-pod
   ...
-RC
apiVersion: v1
kind: ReplicationController
metadata:
  name: sample-rc1
spec:
  replicas: 1
  selector:
a: "1"
  ...
--

After creating this two resources we have one single pod (sample-rc1 "adopts" 
existing pod...nice). But, if we create another replication controller with the 
same selector, changing only the rc name (ex. sample-rc2), another pod is 
launched. Didn't expect this second pod instance...

I know my scenario does not make much sense. However, in the tutorial mentioned 
above this happens and it's usage is at least reasonable.

Rui

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] Replication controller pod "adoption"

2017-08-02 Thread Rodrigo Campos
On Wednesday, August 2, 2017,  wrote:

> Hi all.
>
> According this tutorial (https://github.com/kubernetes/examples/tree/
> master/staging/storage/redis), replication controllers will "adopt"
> existing pods whose labels match the replication controller selector
> labels. The "adoption" is only used to count existing PODs. If it's
> required to launch a new POD, replication controller pod template will me
> used. (at least it's my interpretation).
>
> However there's a behavior that's odd. If we create:
>
> 1. A pod P1 with two containers C1 and C2: labels: X=1, Y=2
> 2. A replication controller RC1 that controls the number of C1 replicas,


No, a replication controller will control the number of pods, not
containers in a pod or something. As also, labels are per pod, not
containers.


Does it make sense now? :)

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.