...
Create NodePort service on both sites in "onap" namespace. Make sure the kubectl version is 1.9x. Use attached - mysql-nodeport.yaml.
Info |
---|
You can skip this step if the node port service are verified in step #1. This step is to be followed on both sites. |
Code Block |
---|
ubuntu@k8s-s1-master:~$ cat dbmysql-npnodeport.yaml apiVersion: v1 kind: Service metadata: name: mysql-nodeport namespace: "onap" labels: statefulset.kubernetes.io/pod-name: sdnc-dbhost-0 spec: ports: - name: "sdnc-dbhost-0-port-3306" port: 3306 targetPort: 3306 nodePort: 30231 - name: "sdnc-dbhost-0-port-3307" port: 3307 targetPort: 3307 nodePort: 30232 type: NodePort selector: statefulset.kubernetes.io/pod-name: sdnc-dbhost-0 ubuntu@k8s-s1-master:~$ #create nodeport service ubuntu@k8s-s1-master:~$ kubectl create -f dbmysql-npnodeport.yaml service "mysql-nodeport" created #verify created service ubuntu@k8s-s1-master:~$ kubectl get svc -n onap | grep mysql-nodeport mysql-nodeport NodePort 10.107.197.242 <none> 3306:30031/TCP,3307:30032/TCP 29s ubuntu@k8s-s1-master:~$ #verify the endpoints are assigned for the service ubuntu@k8s-s1-master:~$ kubectl describe svc mysql-nodeport -n onap Name: mysql-nodeport Namespace: onap Labels: statefulset.kubernetes.io/pod-name=sdnc-dbhost-0 Annotations: <none> Selector: statefulset.kubernetes.io/pod-name=sdnc-dbhost-0 Type: NodePort IP: 10.107.197.242 Port: sdnc-dbhost-0-port-3306 3306/TCP TargetPort: 3306/TCP NodePort: sdnc-dbhost-0-port-3306 30231/TCP Endpoints: 10.44.0.3:3306 Port: sdnc-dbhost-0-port-3307 3307/TCP TargetPort: 3307/TCP NodePort: sdnc-dbhost-0-port-3307 30232/TCP Endpoints: 10.44.0.3:3307 Session Affinity: None External Traffic Policy: Cluster Events: <none> ubuntu@k8s-s1-master:~$ |
...