渣渣兔 发表于 2024-3-9 12:56:04

Linkerd

Linkerd is a service mesh for Kubernetes. It makes running services easier and safer by giving you runtime debugging, observability, reliability, and security—all without requiring any changes to your code.
Installation

Ensure you have access to the Kubernetes cluster and a functioning kubectl, if not, you could set up Kubernetes cluster on your local machine through Minikube, docker desktop, or kind, etc.
Install linked CLI

For Linux

Follow the instructions from the official site: https://linkerd.io/2.14/getting-started/
curl --proto '=https' --tlsv1.2 -sSfL https://run.linkerd.io/install | shFor Windows

Download the Windows execution file from Github: https://github.com/linkerd/linkerd2/releases/
https://img2023.cnblogs.com/blog/109287/202312/109287-20231228191741795-1367195157.png
No need to install, change the file name to linkerd and add it to the Path environment.
Check whether linked cli is running correctly by
linkerd version Install Linkerd control plane

Check if your cluster is ready for installing Linkerd.
linkerd check --preInstall Linkerd’s Custom Resource Definitions (CRDs), it must be installed first.
linkerd install --crds | kubectl apply -f -Install Linkerd control panel.
linkerd install | kubectl apply -f -You may encounter some installation errors, for example, the one below, based on the error message, change the install command accordingly.
https://img2023.cnblogs.com/blog/109287/202312/109287-20231229011812726-1203026931.png
linkerd install --set proxyInit.runAsRoot=true | kubectl apply -f - Check whether the control plane is installed successfully, linkerd control plane will be deployed to your cluster, a couple of images will be pulled, so make sure you have a workable network.
linkerd checkDeploy Linkerd to your application

First, you need an application deployed in your cluster, you can use the emojivoto application in https://linkerd.io/2.14/getting-started/.
After the application is deployed, add Linkerd's data plane proxy to it.
kubectl get -n emojivoto deploy -o yaml| linkerd inject - | kubectl apply -f -After emojivoto is 'meshed', check the data plane
linkerd -n emojivoto check --proxyDashboard

Install Linkerd's dashboard extension
linkerd viz install | kubectl apply -f -This is the official way to access the dashboard
linkerd viz dashboard &While this doesn't work when I using Windows docker desktop Kubernetes, I got this error
https://img2023.cnblogs.com/blog/109287/202312/109287-20231229172955324-1992890095.png
 Looks like the normal way doesn't work, so let's inspect the web service
kubectl get service web -n linkerd-viz -o yamlAnd, got this, service type is ClusterIP and listening at port 8080 port
apiVersion: v1
kind: Service
metadata:
annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"linkerd.io/created-by":"linkerd/helm stable-2.14.7","linkerd.io/inject":"enabled"},"labels":{"component":"web","linkerd.io/extension":"viz","namespace":"linkerd-viz"},"name":"web","namespace":"linkerd-viz"},"spec":{"ports":[{"name":"http","port":8084,"targetPort":8084},{"name":"admin-http","port":9994,"targetPort":9994}],"selector":{"component":"web","linkerd.io/extension":"viz"},"type":"ClusterIP"}}
    linkerd.io/created-by: linkerd/helm stable-2.14.7
    linkerd.io/inject: enabled
creationTimestamp: "2023-12-29T05:06:38Z"
labels:
    component: web
    linkerd.io/extension: viz
    namespace: linkerd-viz
name: web
namespace: linkerd-viz
resourceVersion: "5396830"
uid: ba0b70ec-89f3-4f9a-a407-492744f3f90b
spec:
clusterIP: 10.106.135.240
clusterIPs:
- 10.106.135.240
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- name: http
    port: 8084
    protocol: TCP
    targetPort: 8084
- name: admin-http
    port: 9994
    protocol: TCP
    targetPort: 9994
selector:
    component: web
    linkerd.io/extension: viz
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}Then we can do a workaround, expose the service outside the cluster
kubectl -n linkerd-viz port-forward svc/web 8084Bingo!!!
https://img2023.cnblogs.com/blog/109287/202312/109287-20231229174045422-2102587474.png
 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: Linkerd