Kubernetes 使用Istio操作员和EKS上的地形安装Istio
我不熟悉地形。我需要在AWS EKS群集上设置Istio。我想到了使用Istio操作符和Terraform来做同样的事情 下面是使用Istio操作符在EKS上安装Istio的shell脚本: 安装-istio.shKubernetes 使用Istio操作员和EKS上的地形安装Istio,kubernetes,terraform,istio,amazon-eks,servicemesh,Kubernetes,Terraform,Istio,Amazon Eks,Servicemesh,我不熟悉地形。我需要在AWS EKS群集上设置Istio。我想到了使用Istio操作符和Terraform来做同样的事情 下面是使用Istio操作符在EKS上安装Istio的shell脚本: 安装-istio.sh # Download and install the Istio istioctl client binary # Specify the Istio version that will be leveraged throughout these instructions ISTI
# Download and install the Istio istioctl client binary
# Specify the Istio version that will be leveraged throughout these instructions
ISTIO_VERSION=1.7.3
curl -sL "https://github.com/istio/istio/releases/download/$ISTIO_VERSION/istioctl-$ISTIO_VERSION-linux-amd64.tar.gz" | tar xz
sudo mv ./istioctl /usr/local/bin/istioctl
sudo chmod +x /usr/local/bin/istioctl
# Install the Istio Operator on EKS
istioctl operator init
# The Istio Operator is installed into the istio-operator namespace. Query the namespace.
kubectl get all -n istio-operator
# Install Istio components
istioctl profile dump default
# Create the istio-system namespace and deploy the Istio Operator Spec to that namespace.
kubectl create ns istio-system
kubectl apply -f istio-operator.yaml
# Validate the Istio installation
kubectl get all -n istio-system
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istio-control-plane
spec:
# Use the default profile as the base
# More details at: https://istio.io/docs/setup/additional-setup/config-profiles/
profile: default
# Enable the addons that we will want to use
addonComponents:
grafana:
enabled: true
prometheus:
enabled: true
tracing:
enabled: true
kiali:
enabled: true
values:
global:
# Ensure that the Istio pods are only scheduled to run on Linux nodes
defaultNodeSelector:
beta.kubernetes.io/os: linux
kiali:
dashboard:
auth:
strategy: anonymous
下面是install-istio.sh使用的istio-operator.yaml文件
# Download and install the Istio istioctl client binary
# Specify the Istio version that will be leveraged throughout these instructions
ISTIO_VERSION=1.7.3
curl -sL "https://github.com/istio/istio/releases/download/$ISTIO_VERSION/istioctl-$ISTIO_VERSION-linux-amd64.tar.gz" | tar xz
sudo mv ./istioctl /usr/local/bin/istioctl
sudo chmod +x /usr/local/bin/istioctl
# Install the Istio Operator on EKS
istioctl operator init
# The Istio Operator is installed into the istio-operator namespace. Query the namespace.
kubectl get all -n istio-operator
# Install Istio components
istioctl profile dump default
# Create the istio-system namespace and deploy the Istio Operator Spec to that namespace.
kubectl create ns istio-system
kubectl apply -f istio-operator.yaml
# Validate the Istio installation
kubectl get all -n istio-system
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
namespace: istio-system
name: istio-control-plane
spec:
# Use the default profile as the base
# More details at: https://istio.io/docs/setup/additional-setup/config-profiles/
profile: default
# Enable the addons that we will want to use
addonComponents:
grafana:
enabled: true
prometheus:
enabled: true
tracing:
enabled: true
kiali:
enabled: true
values:
global:
# Ensure that the Istio pods are only scheduled to run on Linux nodes
defaultNodeSelector:
beta.kubernetes.io/os: linux
kiali:
dashboard:
auth:
strategy: anonymous
下面是执行脚本的main.tf文件
resource "null_resource" "install_istio" {
provisioner "local-exec" {
command = "/bin/bash install-istio.sh"
}
}
我请求您帮我解答几个问题:
非常感谢您抽出时间。谢谢你的帮助 我相信,如果使用这样的本地exec provisioner,您将遇到问题 Terraform不能很好地利用它无法协调的资源。尤其是在CRD方面。此外,每次运行
terraformapply
,您都会反复运行istioctl init
,这可能不是您想要的
你能做的就是
istio操作符/kustomization.yaml
文件kustomization
提供程序kustomization
提供程序安装istio操作员
istio/manifest.yaml
istio/kustomization.yaml
kustomization
资源安装istioperator
/home
/project
/terraform
/istio
terraform.tf
istio_operator.tf
istio.tf
/istio
kustomization.yaml
manifest.yaml
/istio-operator
kustomization.yaml
manifest.yaml
不,这不能解决问题,因为terraform不知道如何删除
null\u资源。反复运行terraformapply
会起作用,但会浪费宝贵的时间。您也可以使用istioctl
手动安装istio。kubernetes alpha
terraform提供程序最终将不再是实验性的,也许它将使将来使用terraform安装kubernetes资源变得更容易。感谢Ludovic回答和分享知识。欢迎您。如果您遇到“鸡或蛋”错误(在安装istio CRD之前无法安装IstioOperator),则只需使用两个不同的terraform模块即可terraform分别应用
。一个用于istio操作符,另一个用于istio控制平面
。您也可以这样做。我不喜欢使用Helm,因为我更喜欢手动配置清单。使用helm很困难,如果您打印出完整的清单(使用istioctl dump
或helm模板
),就容易多了。这就是我为所有企业项目所做的。
# istio-operator.tf
data "kustomization" "istio_operator" {
path = "./istio-operator"
}
resource "kustomization_resource" "istio_operator" {
for_each = data.kustomization.istio_operator.ids
manifest = data.kustomization.istio_operator.manifests[each.value]
}
# istio/manifest.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
name: istio-control-plane
...
# istio/kustomization.yaml
resources:
- manifest.yaml
# istio.tf
data "kustomization" "istio" {
path = "./istio"
}
resource "kustomization_resource" "istio" {
for_each = data.kustomization.istio.ids
manifest = data.kustomization.istio.manifests[each.value]
depends_on = [kustomization_resource.istio_operator]
}
/home
/project
/terraform
/istio
terraform.tf
istio_operator.tf
istio.tf
/istio
kustomization.yaml
manifest.yaml
/istio-operator
kustomization.yaml
manifest.yaml