Installing and configuring Istio components on K8s

Here's a step-by-step guide to installing and configuring Istio components, setting up basic routing, and implementing server-side authentication on Kubernetes:

  1. Install Istio:

  2. Download the latest release of Istio from the official Istio website.

  3. Extract the files from the downloaded package.

  4. Assuming you have a Kubernetes cluster, install Istio by running the following command:

    $ istioctl install --set profile=default

  5. Verify Istio installation:

  6. Run the following command to ensure all necessary Istio components are running:

    $ kubectl get pods -n istio-system

  • All the Istio pods should be in a "Running" state.

  • Enable automatic sidecar injection:

  • Label your Kubernetes namespace to enable automatic sidecar injection by running:

    $ kubectl label namespace <your-namespace> istio-injection=enabled

  • This label allows Istio to automatically inject sidecar proxies into each pod in the specified namespace.

  • Set up basic routing:

  • Create a Kubernetes deployment, service, and virtual service for your application.

  • Create a deployment.yaml file with the necessary configuration for your application deployment.

  • Run the following command to create the deployment:

    $ kubectl apply -f deployment.yaml

  • Create a service.yaml file with the necessary configuration for your application service.

  • Run the following command to create the service:

    $ kubectl apply -f service.yaml

  • Create a virtualservice.yaml file with the necessary configuration for your virtual service, including the destination rules.

  • Run the following command to create the virtual service:

    $ kubectl apply -f virtualservice.yaml

  • This sets up the routing for your application.

  • Implement server-side authentication:

  • Generate a server certificate and a private key for your application.

  • Create a Kubernetes secret to store the server certificate and private key:

    $ kubectl create secret tls <secret-name> --cert=path/to/certificate.crt --key=path/to/private/key.key

  • Update your virtual service configuration to enable server-side authentication and specify the secret:

    apiVersion: networking.istio.io/v1alpha3
    kind: VirtualService
    metadata:
    name: <virtual-service-name>
    spec:
    hosts:
    - <your-domain>
    gateways:
    - <your-gateway>
    http:
    - match:
    - uri:
    prefix: /
    route:
    - destination:
    host: <your-service>
    port:
    number: <your-service-port>
    weight: 100
    tls:
    credentialName: <secret-name>
    mode: SIMPLE

  • Apply the updated virtual service configuration:

    $ kubectl apply -f updated-virtualservice.yaml

  • This enables server-side authentication for your application.

That's it! You have now installed and configured Istio, set up basic routing, and implemented server-side authentication on Kubernetes. You can now further explore advanced Istio features based on your application requirements.

相关推荐
阿里云云原生2 小时前
阿里云正式发布 RCA Benchmark,业界首个面向 Agentic Ops 的根因分析开源基准体系
云原生
marsh02064 小时前
56 openclaw与Serverless:无服务器架构下的应用实践
云原生·架构·serverless
Patrick_Wilson6 小时前
写给前端的 K8s 入门:用一张图和一个例子搞懂 5 个核心概念
云原生·kubernetes·devops
凌睿马7 小时前
离线的银河麒麟系统部署ollama
云原生·eureka
java1234_小锋7 小时前
【吊打面试官系列-ZooKeeper面试题】zookeeper 是如何保证事务的顺序一致性的?
分布式·zookeeper·云原生
my19587021357 小时前
ZooKeeper分布式协调从入门到实战
分布式·zookeeper·云原生
oioihoii7 小时前
ZooKeeper 三节点集群部署:别再单机玩,高可用强一致集群这样搭
分布式·zookeeper·云原生
云游牧者9 小时前
K8S-Helm包管理全解-从入门到Chart开发实战指南
云原生·容器·kubernetes·helm·chart模板
Elastic 中国社区官方博客10 小时前
一个查询,无限 Elasticsearch Serverless 项目:跨项目搜索介绍
大数据·elasticsearch·搜索引擎·信息可视化·云原生·serverless·全文检索
思诺学长11 小时前
从0理解Feed流系统:技术原理、架构设计与实战指南
云原生