Category : Kubernetes | Sub Category : Kubernetes With Java | By Prasad Bonam Last updated: 2023-11-21 14:22:11 Viewed : 612
To deploy Istio resources on your Kubernetes cluster, you can use the Istio command-line interface (Istioctl) or Helm charts. Below, I will provide examples for deploying basic Istio resources using istioctl
.
Download the Istio release from the official Istio releases page. Choose the version that suits your needs.
Extract the downloaded file:
bashtar -zxvf istio-<version>.tar.gz
cd istio-<version
Run the following command to install Istio components on your Kubernetes cluster:
bashistioctl install
This will deploy the core Istio components, including Istio IngressGateway and the necessary Custom Resource Definitions (CRDs).
You can deploy a sample application to test Istio features. Use the following command:
bashkubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
Enable automatic sidecar injection for the namespace where you deploy your application. If you want to enable sidecar injection for the default
namespace, run:
bashkubectl label namespace default istio-injection=enabled
Check the status of the Istio components and the sample application:
bashkubectl get pods -n istio-system kubectl get services -n istio-system kubectl get pods kubectl get services
Create a file named istio-gateway.yaml
with the following content to define an Istio Gateway and VirtualService for the sample application:
yamlapiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: bookinfo-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: bookinfo
spec:
hosts:
- "*"
gateways:
- bookinfo-gateway
http:
- match:
- uri:
exact: /productpage
route:
- destination:
host: productpage
port:
number: 9080
Apply the configuration:
bashkubectl apply -f istio-gateway.yaml
Retrieve the external IP of the Istio Ingress Gateway:
bashkubectl get svc -n istio-system istio-ingressgateway
Access the sample application using the external IP.
If you installed Kiali as part of Istio addons, you can access the Kiali dashboard to visualize the service mesh:
bashkubectl port-forward -n istio-system svc/kiali 20001:20001
Open your browser and navigate to http://localhost:20001.
These are basic steps to deploy Istio resources and a sample application. Depending on your use case, you might need to configure additional Istio features such as traffic management, security policies, or telemetry. Refer to the official Istio documentation for more detailed information and advanced configurations.