New Features of Kubernetes v1.2.0 beta
-
Upload
giragadurai-vallirajan -
Category
Technology
-
view
293 -
download
0
Transcript of New Features of Kubernetes v1.2.0 beta
v1.2.0-beta.0
~ Girag
Outline
● released on March 7, 2016● improved scalability
○ more nodes○ more pods per node
● features from 1.1 time frames and stabilized ○ Horizontal pod auto-scaling API
■ add custom metrics○ Ingress API○ Job API○ DaemonSet API○ Deployment API○ ConfigMap API
○ Make it easier to create resources■ Namespace generation■ Secret/config generation■ export and convert
@girag
● introduced in v1.1● part of extensions api● increase or decrease the pod’s count in replication controller /
deployments as per CPU utilization● implemented as control loop● uses heapster for metric collection (Currently CPU Utilization only)● autoscaling and rolling-update will not work together, if rolling-update
manipulates replica count of replication controller● will support custom metrics too
Horizontal Pod Autoscaler
@girag
apiVersion: extensions/v1beta1kind: HorizontalPodAutoscalermetadata: name: tomcat7 namespace: defaultspec: scaleRef: kind: ReplicationController name: tomcat7 subresource: scale minReplicas: 1 maxReplicas: 5 cpuUtilization: targetPercentage: 80
Horizontal Pod Autoscaler
@girag
apiVersion: extensions/v1beta1kind: HorizontalPodAutoscalermetadata: name: tomcat7 namespace: defaultspec: scaleRef: kind: ReplicationController name: tomcat7 subresource: scale minReplicas: 1 maxReplicas: 5 cpuUtilization: targetPercentage: 80
Horizontal Pod Autoscaler
@girag
HPA created with the name tomcat7 and act as service with 1-5 replications depending on load
if cpuUtilization > 80** and replica < 5 spawn tomcat7else cpuUtiliaztion fall down and sustained for 5 min and replica > 1 remove tomcat7
** when start or stop pods the metric get noises, so hpa wait for a while (3-5 minutes) after every action, for picking right data.
● introduced in v1.1● part of extensions api● set of rules that allow inbound traffic to reach the k8s cluster services.● types
○ Single Service Ingress○ Simple Fanout○ Name based Virtual Hosting○ Loadbalancing
Ingress
@girag
apiVersion: extensions/v1beta1kind: Ingressmetadata: name: virtual-hostingspec: rules: - host: api.gopaddle.io http: paths: - backend: serviceName: bm-gateway servicePort: 80
Ingress - host: beta.gopaddle.io http: paths: - backend: serviceName: bm-dashboard servicePort: 80
- host: doc.gopaddle.io http: paths: - backend: serviceName: bm-docs servicePort: 80
@girag
Ingress - host: beta.gopaddle.io http: paths: - backend: serviceName: bm-dashboard servicePort: 80
- host: doc.gopaddle.io http: paths: - backend: serviceName: bm-docs servicePort: 80
@girag
bm-gateway
bm-dashboard
bm-docs
apiVersion: extensions/v1beta1kind: Ingressmetadata: name: virtual-hostingspec: rules: - host: api.gopaddle.io http: paths: - backend: serviceName: bm-gateway servicePort: 80
172.149.22.101
api beta doc
gopaddle.io
● introduced in v1.1● part of extensions api● build custom lifecycle of pods● creates one or more pods and ensures that a specified number of them
successfully terminate● control lifecycle of pods which has RestartPolicy equal to OnFailure or Never.
Jobs
@girag
apiVersion: extensions/v1beta1kind: Jobmetadata: name: appsvrspec: completions: 4 parallelism: 2 selector: matchLabels: app: appsvr template: metadata: name: appsvr labels: app: appsvr spec: containers: - name: appsvr image: bluemeric/javasvr restartPolicy: Never
Jobs
@girag
apiVersion: extensions/v1beta1kind: Jobmetadata: name: appsvrspec: completions: 4 parallelism: 2 selector: matchLabels: app: appsvr template: metadata: name: appsvr labels: app: appsvr spec: containers: - name: appsvr image: bluemeric/javasvr restartPolicy: Never
Jobs
@girag
Job for appsvr, > .spec.completions : run 4 instance of appsvrs.> .spec.parallelism : run parallelly 2 appsvrs.
● introduced in v1.1● part of extensions api● ensures that all nodes or some (by NodeSelector) runs pod● add a pod from Daemonset, while a node added in to k8s cluster, and
removes and clean pod when node goes off cluster.
Daemon Sets
@girag
apiVersion: extensions/v1beta1kind: DaemonSetmetadata: name: ds-monitor labels:
apps: monitorspec: selector:
apps: monitor template:
metadata: name: d-monitor labels: apps: monitor spec: hostNetwork: true containers: - name: ds-mon image: bm/mon:v2
Daemon Sets
@girag
apiVersion: extensions/v1beta1kind: DaemonSetmetadata: name: ds-monitor labels:
apps: monitorspec: selector:
apps: monitor template:
metadata: name: d-monitor labels: apps: monitor spec: hostNetwork: true containers: - name: ds-mon image: bm/mon:v2
Daemon Sets
@girag
node-01 node-02 node-03
kube-master
monitor monitor monitor
….
….
….
….
….
….
one “monitor” pod per node
● introduced in v1.1● part of extensions api● smoothens deployment process of creating new resources and updating them● supported resource are Pods and Replication Controllers.● while updating, it ensures sufficient capacity of new pod(s) available to serve
and deleting old ones.
Deployments
@girag
apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: appsvr-deploymentspec: replicas: 3 template: metadata: labels: app: appsvr spec: containers: - name: appsvr image: bm/appsvr:v1 ports: - containerPort: 8080
DeploymentsapiVersion: extensions/v1beta1kind: Deploymentmetadata: name: appsvr-deploymentspec: replicas: 5 template: metadata: labels: app: appsvr spec: containers: - name: appsvr image: bm/appsvr:v2 ports: - containerPort: 8080
@girag
apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: appsvr-deploymentspec: replicas: 3 template: metadata: labels: app: appsvr spec: containers: - name: appsvr image: bm/appsvr:v1 ports: - containerPort: 8080
DeploymentsapiVersion: extensions/v1beta1kind: Deploymentmetadata: name: appsvr-deploymentspec: replicas: 5 template: metadata: labels: app: appsvr spec: containers: - name: appsvr image: bm/appsvr:v2 ports: - containerPort: 8080
$ kubectl create -f dep.yaml$ kubectl apply -f dep.yaml
@girag
creates 3 replica of appsvr:v1 pods
update 3 pod with appsvr:v2 when no more outstanding load && creates 2 more replica of appsvr:v2 pods
● introduced in v1.1● part of extensions api● small in size● contains sensitive data like password, access-token, keys● usage
○ file in mounted volume○ used by kublet while pulling images to build pod
Secrets
@girag
apiVersion: v1kind: Secretmetadata: name: user-profiletype: Opaquedata: user: graha password: dmFsdWUtMQ0K
SecretsapiVersion: v1kind: Podmetadata: name: secret-access-podspec: containers:
- name: tester image: kubernetes/mounttest:0.1 command: [ "/mt", "--file_content=/etc/profile/user" ] volumeMounts: # name must match the volume name below - name: profile mountPath: /etc/profile volumes:
- name: profile secret: secretName: user-profile restartPolicy: Never @girag
apiVersion: v1kind: Secretmetadata: name: user-profiletype: Opaquedata: user: graha password: dmFsdWUtMQ0K
SecretsapiVersion: v1kind: Podmetadata: name: secret-access-podspec: containers:
- name: tester image: kubernetes/mounttest:0.1 command: [ "/mt", "--file_content=/etc/profile/user" ] volumeMounts: # name must match the volume name below - name: profile mountPath: /etc/profile volumes:
- name: profile secret: secretName: user-profile restartPolicy: Never @girag
creates a secret store for
user-profile
mounted as file system into /etc/profile
● introduced in v1● part of core api● flexible configuration model for k8s● simplify storing configuration profile for application● dynamic distribution of configuration● usage
○ as environment variable○ in volume○ consistent data even from updating configuration model
ConfigMap
@girag
apiVersion: v1kind: ConfigMapmetadata: name: bm-env-configdata: design-cache: 100 app-cache: 100 n-cmp-thread: 5
ConfigMap
@girag
apiVersion: v1kind: Podmetadata: name: config-test-podspec: containers: - name: config-test-container image: gcr.io/google_containers/busybox command: [ "/bin/sh", "cat", "/etc/config/bm.env" ] volumeMounts: - name: config-volume mountPath: /etc/config volumes: - name: config-volume configMap: name: bm-env-config restartPolicy: Never
apiVersion: v1kind: ConfigMapmetadata: name: bm-env-configdata: design-cache: 100 app-cache: 100 n-cmp-thread: 5
ConfigMap
@girag
apiVersion: v1kind: Podmetadata: name: config-test-podspec: containers: - name: config-test-container image: gcr.io/google_containers/busybox command: [ "/bin/sh", "cat", "/etc/config/bm.env" ] volumeMounts: - name: config-volume mountPath: /etc/config volumes: - name: config-volume configMap: name: bm-env-config restartPolicy: Never
creates a configuration store for bm-env like secrets
mounted as file system into /etc/config
● Locate our work○ www.gopaddle.io○ www.bluemeric.com○ http://www.bluemeric.com/blog/
● Reach us○ @bluemeric○ http://www.bluemeric.com/contact/
Q&A
@girag