Skip to content

Commit e80633e

Browse files
authored
Add a readme for Kubernetes Jenkins (pulumi#70)
1 parent 58edd3a commit e80633e

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

kubernetes-ts-jenkins/README.md

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Kubernetes Jenkins
2+
3+
This example deploys a container running the Jenkins continuous integration system onto a running
4+
Kubernetes cluster using Pulumi and `@pulumi/kubernetes`.
5+
6+
## Running the App
7+
8+
Follow the steps in [Pulumi Installation and Setup](https://docs.pulumi.com/install/) and [Configuring Pulumi
9+
Kubernetes](https://docs.pulumi.com/reference/kubernetes.html#configuration) to get setup with Pulumi and Kubernetes.
10+
11+
> *Note*: The code in this repo assumes you are deploying to a cluster that supports the
12+
> [`LoadBalancer`](https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer) service type.
13+
> This includes most cloud providers as well as [Docker for Mac Edge w/
14+
> Kubernetes](https://docs.docker.com/docker-for-mac/kubernetes/). If not (for example if you are targeting `minikube`
15+
> or your own custom Kubernetes cluster), replace `type: "LoadBalancer"` with `type: "ClusterIP"` in `jenkins.ts`. See
16+
> the Kubernetes [Services
17+
> docs](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types) for more
18+
> details.
19+
20+
Install dependencies:
21+
22+
```
23+
$ npm install
24+
```
25+
26+
Create a new stack:
27+
28+
```
29+
$ pulumi stack init
30+
Enter a stack name: kubernetes-ts-jenkins-dev
31+
```
32+
33+
Create configuration keys for the root username and password for the Jenkins instance we are
34+
about to create:
35+
36+
```
37+
$ pulumi config set jenkins:username <your desired username>
38+
$ pulumi config set jenkins:password <your desired password> --secret
39+
```
40+
41+
Preview the deployment of the application:
42+
43+
```
44+
$ pulumi preview
45+
Previewing update of stack 'kubernetes-ts-jenkins-dev'
46+
Type Name Status Info
47+
* global global unchanged
48+
Previewing changes:
49+
50+
Type Name Status Info
51+
* global global no change
52+
+ pulumi:pulumi:Stack kubernetes-ts-jenkins-kubernetes-ts-jenkins-dev create
53+
+ └─ jenkins:jenkins:Instance jenkins create
54+
+ ├─ kubernetes:core:v1:Secret jenkins-secret create
55+
+ ├─ kubernetes:core:v1:PersistentVolumeClaim jenkins-pvc create
56+
+ ├─ kubernetes:core:v1:Service jenkins-service create
57+
+ └─ kubernetes:extensions:v1beta1:Deployment jenkins-deploy create
58+
59+
info: 6 changes previewed:
60+
+ 6 resources to create
61+
```
62+
63+
Perform the deployment:
64+
65+
```
66+
$ pulumi update --skip-preview
67+
Updating stack 'kubernetes-ts-jenkins-dev'
68+
Type Name Status Info
69+
* global global unchanged
70+
Performing changes:
71+
72+
Type Name Status Info
73+
* global global unchanged
74+
+ pulumi:pulumi:Stack kubernetes-ts-jenkins-kubernetes-ts-jenkins-dev created
75+
+ └─ jenkins:jenkins:Instance jenkins created
76+
+ ├─ kubernetes:core:v1:Secret jenkins-secret created
77+
+ ├─ kubernetes:core:v1:PersistentVolumeClaim jenkins-pvc created
78+
+ ├─ kubernetes:core:v1:Service jenkins-service created
79+
+ └─ kubernetes:extensions:v1beta1:Deployment jenkins-deploy created
80+
81+
info: 6 changes performed:
82+
+ 6 resources created
83+
Update duration: 2m30.397621136s
84+
```
85+
86+
The deployment is complete! Use `kubectl` to see the Service that we just deployed:
87+
88+
```
89+
$ kubectl get services
90+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
91+
jenkins LoadBalancer 10.43.241.251 35.230.56.127 80:30638/TCP,443:30204/TCP 3m
92+
```
93+
94+
The Jenkins instance we just deployed is reachable through port 80 of the external IP address. You can now
95+
visit `http://35.230.56.127/jenkins/login` in a Web browser to begin the first-install flow for your new Jenkins instance.
96+
You can use the username and password that you saved in your Pulumi config to log in to your new Jenkins instance.
97+
98+
> *Note*: If you are deploying to a cluster that does not support `type: "LoadBalancer"`, and deployed the example using
99+
> `type: "ClusterIP"` instead, run `kubectl port-forward svc/jenkins 8080:80` to forward the cluster port to the local
100+
> machine and access the service via `localhost:8080`.
101+
102+
When you're ready to be done with Jenkins, you can destroy the instance:
103+
104+
```
105+
$ pulumi destroy
106+
Do you want to perform this destroy? yes
107+
Destroying stack 'kubernetes-ts-jenkins-dev'
108+
Performing changes:
109+
110+
Type Name Status Info
111+
- pulumi:pulumi:Stack kubernetes-ts-jenkins-kubernetes-ts-jenkins-dev deleted
112+
- └─ jenkins:jenkins:Instance jenkins deleted
113+
- ├─ kubernetes:extensions:v1beta1:Deployment jenkins-deploy deleted
114+
- ├─ kubernetes:core:v1:Service jenkins-service deleted
115+
- ├─ kubernetes:core:v1:PersistentVolumeClaim jenkins-pvc deleted
116+
- └─ kubernetes:core:v1:Secret jenkins-secret deleted
117+
118+
info: 6 changes performed:
119+
- 6 resources deleted
120+
Update duration: 18.202009282s
121+
```

0 commit comments

Comments
 (0)