Explore the Istio Service Mesh
1.Explorer Observability
Open the dashboard:
1 |
|
Kiali: default username/password: admin/admin
1.1 Grafana
In the grapana. Home->Istio->Istio Workload Dashboard.
Open the dashboard:
1 | #!/bin/bash |
Kiali: default username/password: admin/admin
In the grapana. Home->Istio->Istio Workload Dashboard.
The sidecar intercepts all network traffic.
istioctl kube-inject -f NormalDeployment.yaml
or
kubectl label namespace myspace istio-injection=enabled
Custom Resources extend the API
Custom Controllers provide the functionality - continually maintains the desired state - to monitor its state and reconcile the resource to match with the configuration
https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
Custom Resource Definitions (CRDs) in version 1.7
1 | $ kubectl get crds |
1 | apiVersion: apiextensions.k8s.io/v1beta1 |
cheese-pizza.yaml
Say you have a service mynode
in yourspace
and a service myapp
in myspace
. If the myapp
wants to access the mynode
servcie, the url is:
1 | mynode.yourspace.svc.cluster.local:8000 # 8000 is the service port, not the node port. |
kubectl scale --replicas=3 deployment xxx
1 | StrategyType: RollingUpdate |
1 | template: |
Once you understand the basics then you can try the advanced demonstration. Where a stateful shopping cart is preserved across a rolling update based on leveraging the readiness probe.
https://github.com/redhat-developer-demos/popular-movie-store
More information on Live & Ready
https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
1 | kubectl get pods |
1 | kubectl exec -it pod-name /bin/bash |
1 | apiVersion: apps/v1 |
First Let’s see the environment.
Change the environment on deployment:
1 | kubectl set env deployment/myboot GREETING="hi" |
Find a base image: docker.io, quay.io, gcr.io, registry.redhat.io
Craft your Dockerfile
Configure docker: eval $(minikube --profile myprofile decoder-env)
Build your image: docker build -t liulx/myimage:v1 .
a. Test via:
- `docker run -it -p 8080:8080 --name myboot liulx/myimage:v1`
- `docker run -d -p 8080:8080 --name my boot liulx/myboot:v1`
- `curl $(minikube --profile myprofile ip):8080`
b. If remote repo, do docker tag
and docker push
c. docker stop containername
to stop testing
kubectl apply -f myDeployment.yaml
kubectl apply -f myService.yaml
Expose a URL via your kubernetes distribution’s load-balancer
1 | docker build -t something/animagename:tag |
The .
indicates where to find the Dockerfile and assets to be included in the build process.
You can alse explicitly identify the Dockerfile:
docker build -t somestring/animagename:tag -f somedirectory/Dockerfile_Production .
docker build -t somestring/animagename:tag -f somedirectory/Dockerfile_Testing .
docker build -f src/main/docker/Dockerfile.native -t mystuff/myimage:v1 .
Options Include:
docker build
then kubectl run
or kubectl create -f deploy.yml
OpenShift is Red Hat’s distribution of Kubernetes
minikube and minishift are essentially equivalent and will be used for the demonstrations/examples below.
Downloads & Install Kubectl CLI
1 | # MacOS |
Linux & Windows instructions for finding and downloading the a kubectl https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl
Download & Install Minikube Cluster
示例代码地址:这里
1 | <?xml version="1.0" encoding="UTF-8"?> |
将端口设置为8080(默认就是的,并且设置tomcat的字符集为UTF-8
1 | server: |
spring boot更多预置参数请参考:
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
GOROOT就是go的安装路径
在~/.bash_profile
中添加下面语句:
1 | GOROOT=/usr/local/go |
go install/get/run
会用到的目录。它的下面有3个文件夹:
可以设置多个子目录到GOPATH中
1 | export GOPATH=~/golib:~/goproject |
JPA: Java Persistence API 它是从EJB3中抽取出来的。
EntityManagerFactory
EntityManager
persistence.xml
@Entity
@Column
@Table
要使用JPA,我们需要添加依赖:
1 | compile group: 'javax', name: 'javaee-api', version: '7.0' |
我们来新建数据:
1 | @Entity |
然后配置数据源:
1 | @Configuration |