Complete the code to create a managed Kubernetes cluster using AWS EKS CLI.
aws eks create-cluster --name my-cluster --role-arn [1] --resources-vpc-config subnetIds=subnet-12345,subnet-67890
The role-arn must be the IAM role that allows EKS to manage the cluster resources. The EKSClusterRole is the correct role for this.
Complete the command to update kubeconfig for accessing the managed EKS cluster.
aws eks update-kubeconfig --name [1]You must specify the exact cluster name you created, which is my-cluster in this case, to update your kubeconfig correctly.
Fix the error in the command to create a node group for the EKS cluster.
aws eks create-nodegroup --cluster-name my-cluster --nodegroup-name [1] --subnets subnet-12345 subnet-67890 --node-role arn:aws:iam::123456789012:role/EKSNodeRole
Node group names cannot contain spaces. Use a single string like default-node-group.
Fill both blanks to define a Kubernetes deployment YAML snippet for a managed cluster.
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:[1] ports: - containerPort: [2]
The image tag should specify a valid tag like latest. The default HTTP port for nginx is 80.
Fill all three blanks to create a Kubernetes service YAML snippet exposing the deployment.
apiVersion: v1 kind: Service metadata: name: nginx-service spec: type: [1] selector: app: [2] ports: - protocol: TCP port: [3] targetPort: 80
The service type LoadBalancer exposes the service externally. The selector must match the deployment label nginx. The port exposed is 80.