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 | sh
复制代码 For Windows
Download the Windows execution file from Github: https://github.com/linkerd/linkerd2/releases/
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 Install Linkerd control plane
Check if your cluster is ready for installing Linkerd.Install 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.
- 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.Deploy 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 --proxy
复制代码 Dashboard
Install Linkerd's dashboard extension- linkerd viz install | kubectl apply -f -
复制代码 This is the official way to access the dashboardWhile this doesn't work when I using Windows docker desktop Kubernetes, I got this error
Looks like the normal way doesn't work, so let's inspect the web service- kubectl get service web -n linkerd-viz -o yaml
复制代码 And, 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 8084
复制代码 Bingo!!!
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |