Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using external services inside Kubernetes

Using external services inside Kubernetes

Maxim Filatov

June 17, 2018
Tweet

More Decks by Maxim Filatov

Other Decks in Technology

Transcript

  1. Database failure Database failure export DATABASE_URL='postgresql://[email protected]:5432/production_db' You should resetup ALL

    related deployments and restart ALL theirs pods for hosted service address recon guration
  2. Database failure Database failure update DNS record Remember about DNS

    cache Actually it is easier to kill all related pods
  3. Obvious example Obvious example $ kubectl get endpoints kubernetes NAME

    ENDPOINTS AGE kubernetes 192.168.0.1:8443,192.168.0.2:8443,192.168.0.3:8443 1y $ kubectl get service kubernetes NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.0.0.1 none 443/TCP 1y
  4. In YAML: endpoint In YAML: endpoint apiVersion: v1 kind: Endpoints

    metadata: name: kubernetes namespace: default subsets: - addresses: - ip: 192.168.0.1 - ip: 192.168.0.2 - ip: 192.168.0.3 ports: - name: https port: 8443 protocol: TCP
  5. In YAML: service In YAML: service apiVersion: v1 kind: Service

    metadata: labels: component: apiserver provider: kubernetes name: kubernetes namespace: default spec: clusterIP: 10.0.0.1 ports: - name: https port: 443 protocol: TCP targetPort: 8443 type: ClusterIP
  6. Endpoint Endpoint apiVersion: v1 kind: Endpoints metadata: name: postgres namespace:

    hosted subsets: - addresses: - ip: 192.168.0.10 ports: - name: postgres port: 5432 protocol: TCP
  7. Service Service apiVersion: v1 kind: Service metadata: name: postgres namespace:

    hosted spec: ports: - name: postgres port: 5432 protocol: TCP targetPort: 5432 type: ClusterIP
  8. RIGHT! RIGHT! Service address is rock solid Service IP can

    be preserved in service manifest Any host network recon guration is just endpoint upgrade Endpoint upgrade is rocket fast - kube-proxy rocks!