Skip to content

Instantly share code, notes, and snippets.

@arun-gupta
Last active May 2, 2019 06:10
Show Gist options
  • Save arun-gupta/9603b93a0bb4fb6c4817d078d14cf5fd to your computer and use it in GitHub Desktop.
Save arun-gupta/9603b93a0bb4fb6c4817d078d14cf5fd to your computer and use it in GitHub Desktop.
knative + kubernetes + aws

Knative on Kubernetes on AWS

Knative requires Kubernetes 1.10 and Istio 0.8.0 to be installed. It also requires default namespace injection for Istio to be enabled which rules out EKS as a deployment platform. One of Istio pods is failing and so it cannot be installed on a kops-based cluster as well. This is filed as knative/docs#359.

EKS

  • Install eksctl: brew install weaveworks/tap/eksctl
  • Create EKS cluster: eksctl create cluster --name myeks --nodes 4 --region us-west-2
    2018-08-27T16:41:45-07:00 [ℹ]  setting availability zones to [us-west-2b us-west-2a us-west-2c]
    2018-08-27T16:41:45-07:00 [ℹ]  importing SSH public key "/Users/argu/.ssh/id_rsa.pub" as "eksctl-myeks-df:48:1c:af:8a:1e:22:1a:ff:2d:13:83:c6:53:29:7b"
    2018-08-27T16:41:45-07:00 [ℹ]  creating EKS cluster "myeks" in "us-west-2" region
    2018-08-27T16:41:45-07:00 [ℹ]  creating VPC stack "EKS-myeks-VPC"
    2018-08-27T16:41:45-07:00 [ℹ]  creating ServiceRole stack "EKS-myeks-ServiceRole"
    2018-08-27T16:42:26-07:00 [✔]  created ServiceRole stack "EKS-myeks-ServiceRole"
    2018-08-27T16:42:46-07:00 [✔]  created VPC stack "EKS-myeks-VPC"
    2018-08-27T16:42:46-07:00 [ℹ]  creating control plane "myeks"
    2018-08-27T16:52:09-07:00 [✔]  created control plane "myeks"
    2018-08-27T16:52:09-07:00 [ℹ]  creating DefaultNodeGroup stack "EKS-myeks-DefaultNodeGroup"
    2018-08-27T16:55:50-07:00 [✔]  created DefaultNodeGroup stack "EKS-myeks-DefaultNodeGroup"
    2018-08-27T16:55:50-07:00 [✔]  all EKS cluster "myeks" resources has been created
    2018-08-27T16:55:50-07:00 [✔]  saved kubeconfig as "/Users/argu/.kube/config"
    2018-08-27T16:55:50-07:00 [ℹ]  the cluster has 0 nodes
    2018-08-27T16:55:50-07:00 [ℹ]  waiting for at least 4 nodes to become ready
    2018-08-27T16:56:24-07:00 [ℹ]  the cluster has 4 nodes
    2018-08-27T16:56:24-07:00 [ℹ]  node "ip-192-168-185-40.us-west-2.compute.internal" is ready
    2018-08-27T16:56:24-07:00 [ℹ]  node "ip-192-168-211-20.us-west-2.compute.internal" is ready
    2018-08-27T16:56:24-07:00 [ℹ]  node "ip-192-168-240-119.us-west-2.compute.internal" is ready
    2018-08-27T16:56:24-07:00 [ℹ]  node "ip-192-168-93-231.us-west-2.compute.internal" is ready
    2018-08-27T16:56:25-07:00 [ℹ]  kubectl command should work with "/Users/argu/.kube/config", try 'kubectl get nodes'
    2018-08-27T16:56:25-07:00 [✔]  EKS cluster "myeks" in "us-west-2" region is ready
    
  • curl -o heptio-authenticator-aws https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/darwin/amd64/aws-iam-authenticator
  • Include the download directory in your PATH
  • Get nodes:
    $ kubectl get nodes
    NAME                                            STATUS    ROLES     AGE       VERSION
    ip-192-168-185-40.us-west-2.compute.internal    Ready     <none>    37m       v1.10.3
    ip-192-168-211-20.us-west-2.compute.internal    Ready     <none>    37m       v1.10.3
    ip-192-168-240-119.us-west-2.compute.internal   Ready     <none>    37m       v1.10.3
    ip-192-168-93-231.us-west-2.compute.internal    Ready     <none>    37m       v1.10.3
    
  • Configure Dashboard as explained at https://docs.aws.amazon.com/eks/latest/userguide/dashboard-tutorial.html

Knative requires default namespace injection for Istio to be enabled. At this time, EKS does not enable admission controllers and so Knative installation will require tweaking scripts.

Kops

  • brew update && brew install kops OR brew upgrade kops
  • Create a S3 bucket: aws s3 mb s3://kubernetes-aws-io
  • export KOPS_STATE_STORE=s3://kubernetes-aws-io
  • Check kops version:
    $ kops version
    Version 1.10.0
    
  • Create cluster on us-east-1:
    kops create cluster \
      --zones=us-east-1a,us-east-1b,us-east-1c,us-east-1d \
      --node-count 4 \
      --master-size m5.xlarge \
      --node-size m5.2xlarge \
      --image 379101102735/debian-stretch-hvm-x86_64-gp2-2018-06-13-59294 \
      --name cluster.k8s.local \
      --yes
    
  • Validate cluster:
    $ kops validate cluster
    Using cluster from kubectl context: cluster.k8s.local
    
    Validating cluster cluster.k8s.local
    
    INSTANCE GROUPS
    NAME			ROLE	MACHINETYPE	MIN	MAX	SUBNETS
    master-us-east-1a	Master	m5.xlarge	1	1	us-east-1a
    nodes			Node	m5.2xlarge	4	4	us-east-1a,us-east-1b,us-east-1c,us-east-1d
    
    NODE STATUS
    NAME				ROLE	READY
    ip-172-20-101-158.ec2.internal	node	True
    ip-172-20-150-204.ec2.internal	node	True
    ip-172-20-51-155.ec2.internal	master	True
    ip-172-20-58-209.ec2.internal	node	True
    ip-172-20-70-75.ec2.internal	node	True
    
    Your cluster cluster.k8s.local is ready
    
  • Get nodes:
    $ kubectl get nodes
    NAME                             STATUS    ROLES     AGE       VERSION
    ip-172-20-101-158.ec2.internal   Ready     node      4m        v1.10.3
    ip-172-20-150-204.ec2.internal   Ready     node      4m        v1.10.3
    ip-172-20-51-155.ec2.internal    Ready     master    5m        v1.10.3
    ip-172-20-58-209.ec2.internal    Ready     node      4m        v1.10.3
    ip-172-20-70-75.ec2.internal     Ready     node      4m        v1.10.3
    
  • Install knative as explained at https://github.com/knative/docs/blob/master/install/Knative-with-any-k8s.md
  • One of Istio pods is failing as explained at knative/docs#359
@countspongebob
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment