Giter VIP home page Giter VIP logo

kubernetes-guides's Introduction

Slack GitHub Discussions NPM version Python version NuGet version GoDoc License Gitpod ready-to-code

Pulumi's Infrastructure as Code SDK is the easiest way to build and deploy infrastructure, of any architecture and on any cloud, using programming languages that you already know and love. Code and ship infrastructure faster with your favorite languages and tools, and embed IaC anywhere with Automation API.

Simply write code in your favorite language and Pulumi automatically provisions and manages your resources on AWS, Azure, Google Cloud Platform, Kubernetes, and 120+ providers using an infrastructure-as-code approach. Skip the YAML, and use standard language features like loops, functions, classes, and package management that you already know and love.

For example, create three web servers:

const aws = require("@pulumi/aws");
const sg = new aws.ec2.SecurityGroup("web-sg", {
    ingress: [{ protocol: "tcp", fromPort: 80, toPort: 80, cidrBlocks: ["0.0.0.0/0"] }],
});
for (let i = 0; i < 3; i++) {
    new aws.ec2.Instance(`web-${i}`, {
        ami: "ami-7172b611",
        instanceType: "t2.micro",
        vpcSecurityGroupIds: [sg.id],
        userData: `#!/bin/bash
            echo "Hello, World!" > index.html
            nohup python -m SimpleHTTPServer 80 &`,
    });
}

Or a simple serverless timer that archives Hacker News every day at 8:30AM:

const aws = require("@pulumi/aws");

const snapshots = new aws.dynamodb.Table("snapshots", {
    attributes: [{ name: "id", type: "S", }],
    hashKey: "id", billingMode: "PAY_PER_REQUEST",
});

aws.cloudwatch.onSchedule("daily-yc-snapshot", "cron(30 8 * * ? *)", () => {
    require("https").get("https://news.ycombinator.com", res => {
        let content = "";
        res.setEncoding("utf8");
        res.on("data", chunk => content += chunk);
        res.on("end", () => new aws.sdk.DynamoDB.DocumentClient().put({
            TableName: snapshots.name.get(),
            Item: { date: Date.now(), content },
        }).promise());
    }).end();
});

Many examples are available spanning containers, serverless, and infrastructure in pulumi/examples.

Pulumi is open source under the Apache 2.0 license, supports many languages and clouds, and is easy to extend. This repo contains the pulumi CLI, language SDKs, and core Pulumi engine, and individual libraries are in their own repos.

Welcome

  • Get Started with Pulumi: Deploy a simple application in AWS, Azure, Google Cloud, or Kubernetes using Pulumi.

  • Learn: Follow Pulumi learning pathways to learn best practices and architectural patterns through authentic examples.

  • Examples: Browse several examples across many languages, clouds, and scenarios including containers, serverless, and infrastructure.

  • Docs: Learn about Pulumi concepts, follow user-guides, and consult the reference documentation.

  • Registry: Find the Pulumi Package with the resources you need. Install the package directly into your project, browse the API documentation, and start building.

  • Pulumi Roadmap: Review the planned work for the upcoming quarter and a selected backlog of issues that are on our mind but not yet scheduled.

  • Community Slack: Join us in Pulumi Community Slack. All conversations and questions are welcome.

  • GitHub Discussions: Ask questions or share what you're building with Pulumi.

Getting Started

Watch the video

See the Get Started guide to quickly get started with Pulumi on your platform and cloud of choice.

Otherwise, the following steps demonstrate how to deploy your first Pulumi program, using AWS Serverless Lambdas, in minutes:

  1. Install:

    To install the latest Pulumi release, run the following (see full installation instructions for additional installation options):

    $ curl -fsSL https://get.pulumi.com/ | sh
  2. Create a Project:

    After installing, you can get started with the pulumi new command:

    $ mkdir pulumi-demo && cd pulumi-demo
    $ pulumi new hello-aws-javascript

    The new command offers templates for all languages and clouds. Run it without an argument and it'll prompt you with available projects. This command created an AWS Serverless Lambda project written in JavaScript.

  3. Deploy to the Cloud:

    Run pulumi up to get your code to the cloud:

    $ pulumi up

    This makes all cloud resources needed to run your code. Simply make edits to your project, and subsequent pulumi ups will compute the minimal diff to deploy your changes.

  4. Use Your Program:

    Now that your code is deployed, you can interact with it. In the above example, we can curl the endpoint:

    $ curl $(pulumi stack output url)
  5. Access the Logs:

    If you're using containers or functions, Pulumi's unified logging command will show all of your logs:

    $ pulumi logs -f
  6. Destroy your Resources:

    After you're done, you can remove all resources created by your program:

    $ pulumi destroy -y

To learn more, head over to pulumi.com for much more information, including tutorials, examples, and details of the core Pulumi CLI and programming model concepts.

Platform

Languages

Language Status Runtime Versions
JavaScript Stable Node.js Current, Active and Maintenance LTS versions
TypeScript Stable Node.js Current, Active and Maintenance LTS versions
Python Stable Python Supported versions
Go Stable Go Supported versions
.NET (C#/F#/VB.NET) Stable .NET Supported versions
Java Public Preview JDK 11+
YAML Stable n/a n/a

EOL Releases

The Pulumi CLI v1 and v2 are no longer supported. If you are not yet running v3, please consider migrating to v3 to continue getting the latest and greatest Pulumi has to offer! ๐Ÿ’ช

Clouds

Visit the Registry for the full list of supported cloud and infrastructure providers.

Contributing

Visit CONTRIBUTING.md for information on building Pulumi from source or contributing improvements.

kubernetes-guides's People

Contributors

brunosaboia avatar cangussu avatar cnunciato avatar dependabot[bot] avatar hausdorff avatar jaxxstorm avatar lblackstone avatar metral avatar mikhailshilkov avatar pgavlin avatar rosskevin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubernetes-guides's Issues

[AWS] Reduce dependency on high-privilege objects from @pulumi/eks

Currently @pulumi/eks requires very expansive permissions:

  • Create/delete permissions for IAM Roles, RolePolicyAttachments, InstanceProfile, etc.
  • Create/delete permissions for SecurityGroup and SecurityGroupRule.
  • Create/delete permissions for various EC2 resource types, like ASGs.

We should change the EKS package to allow us to deploy the IAM and SecurityGroup resources separately from the EKS compute resources, like ASGs. Notably, we already don't provision VPCs for the user, so there is some precedent for this.

Rationale: is that IAM and SecurityGroup are perhaps the highest blast radius resource types in the AWS API. In particular, they have among the most serious security implications when misconfigured. Admin permissions should therefore be granted very, very sparingly.

It should be simple to split out the SecurityGroups; for IAM, the industry-standard best practice is to have a three-tiered permissions model:

  • [Very small] IAM admins: have administrative permissions over IAM.
  • [Most/all of engineering] IAM users: are allowed to pass existing roles to other resources, but can't create their own. Users in this group can also administrate their own passwords.
  • [Everything else] No IAM Permissions: no permissions whatsoever.

Add Travis CI integration

KtPW has a bunch of scripts that make it easy to integrate with CI systems, but no specific guidance on how to accomplish this.

wordpress service, creating pvc is forbidden

running through the lab, I am new to pulumi.

When I do pulumi up for the wordpress service, it cannot create the pvc.

Here is the diagnostics, using the default wordpress helm chart 2.1.3. Also tried with the actual latest wordpress chart 5.2.2 with similar results.

Diagnostics:
  kubernetes:extensions:Deployment (wpdev-wordpress):
    error: Plan apply failed: 3 errors occurred:
    
    * Timeout occurred for 'wpdev-wordpress'
    * Minimum number of Pods to consider the application live was not attained
    * 1 Pods failed to schedule because: [Unschedulable] persistentvolumeclaim "wpdev-wordpress" not found
 
  kubernetes:core:Service (wpdev-mariadb):
    error: Plan apply failed: 2 errors occurred:
    
    * Timeout occurred for 'wpdev-mariadb'
    * Service does not target any Pods. Selected Pods may not be ready, or field '.spec.selector' may not match labels on any Pods
 
  kubernetes:core:PersistentVolumeClaim (wpdev-wordpress):
    error: Plan apply failed: persistentvolumeclaims "wpdev-wordpress" is forbidden: Internal error occurred: 2 default StorageClasses were found
 
  kubernetes:core:Service (wpdev-wordpress):
    error: Plan apply failed: 2 errors occurred:
    
    * Timeout occurred for 'wpdev-wordpress'
    * Service does not target any Pods. Selected Pods may not be ready, or field '.spec.selector' may not match labels on any Pods

[AWS, Azure, GCP] Break out networking into their own stack

Networking and security infrastructure like (in the case of AWS) VPCs and SecurityGroups have significant security implications in their setup, and the blast radius of changes to this plane are very high. We should split these into their own stacks, instead of provisioning them along with databases and compute.

Our current plan for each of the clouds, roughly, is to have an architecture with:

  • A subnet with a small set of publicly-available hosts (e.g., bastion hosts)
  • A subnet with a larger set of hosts which can only be reached from the publicly-available hosts
  • A subnet with the managed data services (e.g., RDS) which can only be reached from the managed compute subnet.

GCP 03-cluster-configuration README.md incongruences

README.md Step 4 and config.ts Pulumi key names do not match.


README.md: Step 4, config set examples

$ pulumi config set k8s-gke-cluster:identityStackRef myUser/k8s-gcp-identity/dev-1573589109
$ pulumi config set k8s-gke-cluster:infraStackRef myUser/k8s-gcp-infra/dev-1573589378

config.ts: lines 5 & 6

const identityStackName = new pulumi.StackReference(pulumiConfig.require("identityStackName"));
const infraStackName = new pulumi.StackReference(pulumiConfig.require("infraStackName"));

A C#/.NET Version of the Crosswalk for Kubernetes

Hello!

  • Vote on this issue by adding a ๐Ÿ‘ reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

The Crosswalk for Kubernetes guide and code in this repo is written in TypeScript. I'd appreciate a .NET version also.

https://www.pulumi.com/docs/guides/crosswalk/kubernetes/

While trying to migrate the TypeScript version to C# I've discovered that there are differences in the Azure AD Identity API e.g.

  1. I cannot set replyUrls or type on Pulumi.AzureAD.ApplicationArgs.
  2. ServicePrincipalPassword does not have a Value or EndDate property to set the password or its expiry.
  3. Assignment does not have the PrincipalId or RoleDefinitionName.
  4. Group does not have a Name property.

[AWS, Azure] Implement identity bootstrapping

The basic idea in our model is that the user will bootstrap infrastructure with the following series of actions:

  1. Create an account on one of the major cloud providers.
  2. Use the root account to provision the Pulumi identity stack.
  3. Once the identity stack is provisioned, we should have a user account for CI on the identity stack. This account has IAM admin permissions -- and ideally nothing else. Set up CI (e.g., using travis CI) to use this account.
  4. All groups, policies, roles, as well as many service accounts, and sometimes users, should henceforth be provisioned via PR.
  5. Don't use the root account again, ever, unless you need to.

Currently this is already implemented for GCP.

Azure code does not build

What happened?

After a fresh clone of the project and following the instructions in azure/01-identity the code has many type errors and does not build.

I assume that this is because the code is written for an old version of the Pulumi Azure providers. Dependencies in package.json should be explicit rather than use 'latest' or the code should be updated.

Pulumi cli: v3.46.1
npm ls --depth 0
.../kubernetes-guides/azure/01-identity
โ”œโ”€โ”€ @pulumi/[email protected] invalid: "latest" from the root project
โ”œโ”€โ”€ @pulumi/[email protected] invalid: "latest" from the root project
โ”œโ”€โ”€ @pulumi/[email protected]
โ”œโ”€โ”€ @pulumi/[email protected] invalid: "latest" from the root project
โ”œโ”€โ”€ @types/[email protected]
โ””โ”€โ”€ [email protected]

Steps to reproduce

Clone and follow instructions in azure/01-identity

Expected Behavior

It should depoly project successfully.

Actual Behavior

It fails to build the project out of the box. Additionally pulumi about shows an error running npm ls.

Output of pulumi about

CLI
Version 3.46.1
Go Version go1.19.2
Go Compiler gc

Plugins
NAME VERSION
azure 5.24.0
azuread 5.31.0
nodejs unknown
random 4.8.2

Host
OS darwin
Version 12.6
Arch arm64

This project is written in nodejs: executable='/Users/robin/.nvm/versions/node/v16.16.0/bin/node' version='v16.16.0'

Current Stack: dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend
Name pulumi.com
URL https://app.pulumi.com/robinsummerhill
User robinsummerhill
Organizations robinsummerhill, emuanalytics

Pulumi locates its logs in /var/folders/ww/z6xt_hxs1fj_s7_p2y26pry00000gn/T/ by default
warning: Failed to get information about the Pulumi program's dependencies: failed to run "/Users/robin/.nvm/versions/node/v16.16.0/bin/npm ls --json --depth=0": exit status 1

Additional context

No response

Contributing

Vote on this issue by adding a ๐Ÿ‘ reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

the-dev-staging-prod way?

Is it in scope for this project to also describe dev, staging, and prod workflows? For the moment, (I believe) this repo suggests only a PR -> prod workflow.

Assuming the current repo structure (under gcp/):

identity/
โ”œโ”€โ”€ Pulumi.yaml
โ”œโ”€โ”€ Pulumi.identity.yaml
โ”œโ”€โ”€ index.ts
โ””โ”€โ”€ package.json
infrastructure/
โ”œโ”€โ”€ Pulumi.yaml
โ”œโ”€โ”€ Pulumi.infrastructure.yaml
โ”œโ”€โ”€ index.ts
โ””โ”€โ”€ package.json

I'm puzzled about what "the Prod Way" of supporting a workflow with independent dev, staging and prod environments would look like.

Assuming a branch per environment, e.g. dev, staging, prod, then the Pulumi.<stack-name>.yaml files will (should) differ in at least secretsprovider and encryptedkey across the three branches (at least for self-managed backends) and possibly also for config/gcp:project. So there will always be merge conflicts when promoting features from one environment's branch to another, which opens the door for human error at exactly the points where you want to be reducing the potential for human error (i.e. when graduating from dev to staging or from staging to prod).

I quite liked how identity bootstrapping was described as a series of actions in #13 (comment). If we could come up with an analagous description here to at least spec out a future PR, that would be a pretty great outcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.