简体   繁体   中英

How do I pass in user data to my eks nodes?

I want to pass in user data when my eks nodes deploy, but I'm not sure how to implement that since there isn't a user data argument.

Here's my eks node group resource block

resource "aws_eks_node_group" "nodes_eks" {

  cluster_name    = aws_eks_cluster.eks.name
  node_group_name = "eks-node-group"
  node_role_arn   = aws_iam_role.eks_nodes.arn
  subnet_ids      = module.vpc.private_subnets
  remote_access {
    ec2_ssh_key = aws_key_pair.bastion_auth.id

  }

  scaling_config {
    desired_size = 3
    max_size     = 6
    min_size     = 3
  }

  ami_type             = "AL2_x86_64"
  capacity_type        = "ON_DEMAND"
  force_update_version = false
  instance_types       = [var.instance_type]
  labels = {
    role = "nodes-pool-1"
  }

  version = var.k8s_version

  depends_on = [
    aws_iam_role_policy_attachment.amazon_eks_worker_node_policy,
    aws_iam_role_policy_attachment.amazon_eks_cni_policy,
    aws_iam_role_policy_attachment.amazon_ec2_container_registry_read_only,
  ]
}

All I want to do is run a simple script to install Apache when my nodes are created, but I don't know how without the user data argument

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM