update and set service post deployment

150 views
Skip to first unread message

Norman Khine

unread,
Jun 30, 2017, 8:00:04 AM6/30/17
to Kubernetes user discussion and Q&A
Hello, I have installed mongodb using the helm chart, https://github.com/kubernetes/charts/blob/master/stable/mongodb-replicaset/templates/mongodb-service.yaml#L17, what is the correct way to update the Type and IP for this service, currently it is:

 k8s git:(master) kubectl describe svc trint-mongo-mongodb-replicaset --context zapotec                                                                                                                                                                                                               (git)-[master]
Name: test-mongo-mongodb-replicaset
Namespace: dev
Labels: app=mongodb-replicaset
 chart
=mongodb-replicaset-0.2.0
 heritage
=Tiller
 release
=test-mongo
Annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints=true
Selector: app=mongodb-replicaset,release=test-mongo
Type: ClusterIP
IP
: None
Port: peer 27017/TCP
Endpoints: 10.2.6.6:27017,10.2.84.5:27017,10.2.84.6:27017
Session Affinity: None
Events: <none>


or would I have to rebuild it from the helm chart?

any advise is much appreciated

Rodrigo Campos

unread,
Jun 30, 2017, 8:47:43 AM6/30/17
to kubernet...@googlegroups.com
Just modify the service and do a kubectl apply -f <modified file here>

IIUC, that is all. Can you try that? :)
--
You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-users+unsubscribe@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.

Norman Khine

unread,
Jun 30, 2017, 11:56:07 AM6/30/17
to Kubernetes user discussion and Q&A
Hello,
Ok, so I have cloned the repo and modified the mongodb-service.yaml file, so that

diff --git a/stable/mongodb-replicaset/templates/mongodb-service.yaml b/stable/mongodb-replicaset/templates/mongodb-service.yaml
index d2903e7
..bd952b9 100644
--- a/stable/mongodb-replicaset/templates/mongodb-service.yaml
+++ b/stable/mongodb-replicaset/templates/mongodb-service.yaml
@@ -14,8 +14,8 @@ metadata:
     release
: {{ .Release.Name }}
   name
: {{ template "fullname" . }}
 spec
:
-  type: ClusterIP
-  clusterIP: None
+  type: NodePort
+  clusterIP: 10.3.0.28
   ports
:
     
- name: peer
       port
: {{ .Values.port }}

then running, `helm install . --name test ` , i get:

 mongodb-replicaset git:(feature/mongo/update-type) kubectl get svc                                       (git)-[feature/mongo/update-type]
NAME                       CLUSTER
-IP   EXTERNAL-IP        PORT(S)              AGE
test
-mongodb-replicaset   10.3.0.28    <nodes>            27017:31876/TCP      3m



but now i am getting these errors:


Tolerations: <none>
Events:
 
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
 
--------- -------- ----- ---- ------------- -------- ------ -------
 
9m 9m 2 default-scheduler Warning FailedScheduling [SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "datadir-test-mongodb-replicaset-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "datadir-test-mongodb-replicaset-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "datadir-test-mongodb-replicaset-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "datadir-test-mongodb-replicaset-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "datadir-test-mongodb-replicaset-0", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "datadir-test-mongodb-replicaset-0", which is unexpected.]
 
9m 9m 1 default-scheduler Normal Scheduled Successfully assigned test-mongodb-replicaset-0 to ip-10-0-10-229.eu-west-2.compute.internal
 
9m 9m 1 attachdetach Warning FailedMount Failed to attach volume "pvc-88927d4f-5da9-11e7-93c0-06b40d25fce3" on node "ip-10-0-10-229.eu-west-2.compute.internal" with: Error attaching EBS volume "vol-03817831fe7d0c29e" to instance "i-04695822170b439ea": IncorrectState: vol-03817831fe7d0c29e is not 'available'.
 status code
: 400, request id: b7de11b0-9650-4acc-b1f8-935dcfed4895
 
9m 9m 1 attachdetach Warning FailedMount Failed to attach volume "pvc-88927d4f-5da9-11e7-93c0-06b40d25fce3" on node "ip-10-0-10-229.eu-west-2.compute.internal" with: Error attaching EBS volume "vol-03817831fe7d0c29e" to instance "i-04695822170b439ea": IncorrectState: vol-03817831fe7d0c29e is not 'available'.


would i have to setup the volumes manually?

thanks

Norman Khine

unread,
Jun 30, 2017, 12:06:22 PM6/30/17
to Kubernetes user discussion and Q&A
Ignore, I had to pass the `templates/database/mongo/values.yaml` to specify the volume!


persistentVolume
:
  enabled
: true
 
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
 
## Default: volume.alpha.kubernetes.io/storage-class: default
 
##
 
# storageClass: fast
  accessModes
:
   
- ReadWriteOnce
  size
: 30Gi
  annotations
: {}


On Friday, June 30, 2017 at 1:00:04 PM UTC+1, Norman Khine wrote:

Rodrigo Campos

unread,
Jun 30, 2017, 12:42:15 PM6/30/17
to kubernet...@googlegroups.com
So it's working? :)


On Friday, June 30, 2017, Norman Khine <nor...@khine.net> wrote:
--

Norman Khine

unread,
Jun 30, 2017, 2:12:01 PM6/30/17
to kubernet...@googlegroups.com
nope, the pods never initialized ;'( will see if i can trouble-shoot it

--
You received this message because you are subscribed to a topic in the Google Groups "Kubernetes user discussion and Q&A" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubernetes-users/Bq1BbhSZqoU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubernetes-users+unsubscribe@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.



--
%>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )

Rodrigo Campos

unread,
Jun 30, 2017, 5:47:39 PM6/30/17
to kubernet...@googlegroups.com
That is should be independent of the service type change. 

The service is a different object and just exposed running pods. If the pods are not running, then is something related to the deployment/whatever you are using. But should not be the service

Norman Khine

unread,
Jul 1, 2017, 11:00:20 AM7/1/17
to Kubernetes user discussion and Q&A
I see the difference between the service and pods, but I am unsure how to trouble shoot this as the only changes I made was to the two lines here https://github.com/kubernetes/charts/blob/master/stable/mongodb-replicaset/templates/mongodb-service.yaml#L17-L18

diff --git a/stable/mongodb-replicaset/templates/mongodb-service.yaml b/stable/mongodb-replicaset/templates/mongodb-service.yaml
index d2903e7..bd952b9 100644
--- a/stable/mongodb-replicaset/templates/mongodb-service.yaml
+++ b/stable/mongodb-replicaset/templates/mongodb-service.yaml
@@ -14,8 +14,8 @@ metadata:
     release: {{ .Release.Name }}
   name: {{ template "fullname" . }}
 spec:
-  type: ClusterIP
-  clusterIP: None
+  type: NodePort
+  clusterIP: 10.3.0.28
   ports:
     - name: peer
       port: {{ .Values.port }}




 Sandboxes kubectl describe po test-mongo-mongodb-replicaset-0
Name: test-mongo-mongodb-replicaset-0
Namespace: dev
Node: ip-10-0-10-229.eu-west-2.compute.internal/10.0.10.229
Start Time: Fri, 30 Jun 2017 17:09:15 +0100
Labels: app=mongodb-replicaset
 release
=test-mongo
Annotations: kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"StatefulSet","namespace":"dev","name":"test-mongo-mongodb-replicaset","uid":"76eb1449-5dae-11e7-93c0-06b4...
 pod.beta.kubernetes.io/hostname=test-mongo-mongodb-replicaset-0
 pod.beta.kubernetes.io/subdomain=test-mongo-mongodb-replicaset
Status: Pending
IP: 10.2.84.5
Controllers: StatefulSet/test-mongo-mongodb-replicaset
Init Containers:
  install:
    Container ID: docker://c3ba12e715b8e14bea4342e587ffb22b95bf4d7cd38b1705c07eaa0a5827d450
    Image: gcr.io/google_containers/mongodb-install:0.4
    Image ID: docker-pullable://gcr.io/google_containers/mongodb-install@sha256:2028aa0e1f1377a045993032fc84c203a07b533f0fae2b39a6674bbee6e39f06
    Port:
    Args:
      --work-dir=/work-dir
    State: Terminated
      Reason: Completed
      Exit Code: 0
      Started: Fri, 30 Jun 2017 17:09:33 +0100
      Finished: Fri, 30 Jun 2017 17:09:33 +0100
    Ready: True
    Restart Count: 0
    Environment: <none>
    Mounts:
      /config from config (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-wwsc0 (ro)
      /work-dir from workdir (rw)
  bootstrap:
    Container ID: docker://a4c53dd4f84849244e0745d7c7a97236f309791d2cb8ae4a0138088edca9963f
    Image: mongo:3.4
    Image ID: docker-pullable://mongo@sha256:f1ae736ea5f115822cf6fcef6458839d87bdaea06f40b97934ad913ed348f67d
    Port:
    Command:
      /work-dir/peer-finder
    Args:
      -on-start=/work-dir/on-start.sh
      -service=test-mongo-mongodb-replicaset
    State: Running
      Started: Fri, 30 Jun 2017 17:09:34 +0100
    Ready: False
    Restart Count: 0
    Environment:
      POD_NAMESPACE: dev (v1:metadata.namespace)
      REPLICA_SET: rs0
    Mounts:
      /config from config (rw)
      /data/db from datadir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-wwsc0 (ro)
      /work-dir from workdir (rw)
Containers:
  mongodb-replicaset:
    Container ID:
    Image: mongo:3.4
    Image ID:
    Port: 27017/TCP
    Command:
      mongod
      --config=/config/mongod.conf
    State: Waiting
      Reason: PodInitializing
    Ready: False
    Restart Count: 0
    Liveness: exec [mongo --eval db.adminCommand('ping')] delay=30s timeout=5s period=10s #success=1 #failure=3
    Readiness: exec [mongo --eval db.adminCommand('ping')] delay=5s timeout=1s period=10s #success=1 #failure=3
    Environment: <none>
    Mounts:
      /config from config (rw)
      /data/db from datadir (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-wwsc0 (ro)
      /work-dir from workdir (rw)
Conditions:
  Type Status
  Initialized False
  Ready False
  PodScheduled True
Volumes:
  datadir:
    Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName: datadir-test-mongo-mongodb-replicaset-0
    ReadOnly: false
  config:
    Type: ConfigMap (a volume populated by a ConfigMap)
    Name: test-mongo-mongodb-replicaset
    Optional: false
  workdir:
    Type: EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  default-token-wwsc0:
    Type: Secret (a volume populated by a Secret)
    SecretName: default-token-wwsc0
    Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: <none>
Events: <none>
➜  Sandboxes kubectl logs po test-mongo-mongodb-replicaset-0
Error from server (NotFound): pods "
po" not found
➜  Sandboxes kubectl logs test-mongo-mongodb-replicaset-0
Error from server (BadRequest): container "
mongodb-replicaset" in pod "test-mongo-mongodb-replicaset-0" is waiting to start: PodInitializing

Rodrigo Campos

unread,
Jul 2, 2017, 6:17:51 PM7/2/17
to kubernet...@googlegroups.com
The pod failure can't be related to that. It might be a problem to attach storage or something else, but really really can't be that. They are really different things, something else must have changed.

Rodrigo Campos

unread,
Jul 2, 2017, 6:19:13 PM7/2/17
to kubernet...@googlegroups.com
In fact, the logs suggest there is a problem with the storage. You should zoom there, forget about the service change that is unrelated :)
Reply all
Reply to author
Forward
0 new messages