Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Namerd Kubernetes Deployment
- #
- ---
- # Third Party Resource
- #
- # Note: Third Party Resources are due to be removed in 1.8
- # This should be updated to a Custom Resouce Definition
- # Waiting on word from Buoyant about that on github.com issue
- kind: ThirdPartyResource
- apiVersion: extensions/v1beta1
- metadata:
- name: d-tab.l5d.io
- description: stores dtabs used by namerd
- versions:
- - name: v1alpha1
- ---
- # Configuration
- apiVersion: v1
- kind: ConfigMap
- metadata:
- name: namerd-config
- data:
- config.yaml: |-
- admin:
- ip: 0.0.0.0
- port: 9991
- namers:
- - kind: io.l5d.k8s
- experimental: true
- host: localhost
- port: 8001
- storage:
- kind: io.l5d.k8s
- host: localhost
- port: 8001
- namespace: default
- interfaces:
- - kind: io.l5d.thriftNameInterpreter
- ip: 0.0.0.0
- port: 4100
- - kind: io.l5d.httpController
- ip: 0.0.0.0
- port: 4180
- ---
- # Replication Controller
- kind: ReplicationController
- apiVersion: v1
- metadata:
- name: namerd
- spec:
- replicas: 3
- selector:
- app: namerd
- template:
- metadata:
- labels:
- app: namerd
- spec:
- dnsPolicy: ClusterFirst
- volumes:
- - name: namerd-config
- configMap:
- name: namerd-config
- containers:
- - name: namerd
- image: buoyantio/namerd:1.2.0
- args:
- - /io.buoyant/namerd/config/config.yaml
- ports:
- - name: thrift
- containerPort: 4100
- - name: http
- containerPort: 4180
- - name: admin
- containerPort: 9991
- volumeMounts:
- - name: "namerd-config"
- mountPath: "/io.buoyant/namerd/config"
- readOnly: true
- - name: kubectl
- image: buoyantio/kubectl:v1.4.0
- args:
- - "proxy"
- - "-p"
- - "8001"
- ---
- # Namerd Service
- apiVersion: v1
- kind: Service
- metadata:
- name: namerd
- spec:
- selector:
- app: namerd
- type: ClusterIP
- ports:
- - name: http-outgoing
- port: 4140
- - name: http-incoming
- port: 4141
- - name: h2-outgoing
- port: 4240
- - name: h2-incoming
- port: 4241
- - name: grpc-outgoing
- port: 4340
- - name: grpc-incoming
- port: 4341
- - name: http-ingress
- port: 80
- - name: h2-ingress
- port: 8080
- - name: thrift
- port: 4100
- - name: http
- port: 4180
- - name: admin
- port: 9991
- ---
- #
- # Job to setup default dtabs to enusre our default
- # routing is setup for http, http2 and GRPC
- # This are taken from the linkerd example default configs
- #
- ---
- # Script to create dtabs using namerctl
- kind: ConfigMap
- apiVersion: v1
- metadata:
- name: namerctl-script
- data:
- createNs.sh: |-
- #!/bin/sh
- # HTTP/1.1 Incoming
- set -e
- if namerctl dtab get http-incoming > /dev/null 2>&1; then
- echo "http-incoming dtab already exists"
- else
- echo "
- /k8s => /#/io.l5d.k8s ;
- /portNsSvc => /#/portNsSvcToK8s ;
- /host => /portNsSvc/http/default ;
- /host => /portNsSvc/http ;
- /svc => /$/io.buoyant.http.domainToPathPfx/host ;
- " | namerctl dtab create http-incoming -
- fi
- # HTTP/1.1 Outgoing
- if namerctl dtab get http-outgoing > /dev/null 2>&1; then
- echo "http-outgoing dtab already exists"
- else
- echo "
- /ph => /$/io.buoyant.rinet ;
- /svc => /ph/80 ;
- /svc => /$/io.buoyant.porthostPfx/ph ;
- /k8s => /#/io.l5d.k8s.h2 ;
- /portNsSvc => /#/portNsSvcToK8s ;
- /host => /portNsSvc/h2/default ;
- /host => /portNsSvc/h2 ;
- /svc => /$/io.buoyant.http.domainToPathPfx/host ;
- " | namerctl dtab create http-outgoing -
- fi
- # HTTP/2 Incoming
- set -e
- if namerctl dtab get h2-incoming > /dev/null 2>&1; then
- echo "h2-incoming dtab already exists"
- else
- echo "
- /k8s => /#/io.l5d.k8s ;
- /portNsSvc => /#/portNsSvcToK8s ;
- /host => /portNsSvc/h2/default ;
- /host => /portNsSvc/h2 ;
- /svc => /$/io.buoyant.http.domainToPathPfx/host ;
- " | namerctl dtab create h2-incoming -
- fi
- # HTTP/2 Outgoing
- if namerctl dtab get h2-outgoing > /dev/null 2>&1; then
- echo "h2-outgoing dtab already exists"
- else
- echo "
- /ph => /$/io.buoyant.rinet ;
- /svc => /ph/80 ;
- /svc => /$/io.buoyant.porthostPfx/ph ;
- /k8s => /#/io.l5d.k8s.h2 ;
- /portNsSvc => /#/portNsSvcToK8s ;
- /host => /portNsSvc/h2/default ;
- /host => /portNsSvc/h2 ;
- /svc => /$/io.buoyant.http.domainToPathPfx/host ;
- " | namerctl dtab create h2-outgoing -
- fi
- # gRPC Incoming
- set -e
- if namerctl dtab get grpc-incoming > /dev/null 2>&1; then
- echo "grpc-incoming dtab already exists"
- else
- echo "
- /srv => /#/io.l5d.k8s/default/grpc ;
- /svc => /$/io.buoyant.http.domainToPathPfx/srv ;
- " | namerctl dtab create grpc-incoming -
- fi
- # gRPC Outgoing
- if namerctl dtab get grpc-outgoing > /dev/null 2>&1; then
- echo "grpc-outgoing dtab already exists"
- else
- echo "
- /svc => /$/io.buoyant.hostportPfx/hp ;
- /srv => /#/io.l5d.k8s.grpc/default/grpc;
- /svc => /$/io.buoyant.http.domainToPathPfx/srv ;
- " | namerctl dtab create grpc-outgoing -
- fi
- ---
- # Job which is run only once to bootstrap namerd
- # To re-run this job delete it in kubernetes and apply this config
- kind: Job
- apiVersion: batch/v1
- metadata:
- name: namerctl
- spec:
- template:
- metadata:
- name: namerctl
- spec:
- volumes:
- - name: namerctl-script
- configMap:
- name: namerctl-script
- defaultMode: 0755
- containers:
- - name: namerctl
- image: linkerd/namerctl:0.8.6
- env:
- - name: NAMERCTL_BASE_URL
- value: http://namerd.default.svc.cluster.local:4180
- command:
- - "/namerctl/createNs.sh"
- volumeMounts:
- - name: "namerctl-script"
- mountPath: "/namerctl"
- readOnly: true
- restartPolicy: OnFailure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement